How do you add an onload
event to an element?
Can I use:
for t
You can attach an event listener as below. It will trigger whenever the div having selector #my-id
loads completely to DOM.
$(document).on('EventName', '#my-id', function() {
// do something
});
Inthis case EventName may be 'load' or 'click'
https://api.jquery.com/on/#on-events-selector-data-handler