Home > DeveloperSection > Forums > jQuery.ready() equalent event listener on elements?
Kate Smith
Kate Smith

Total Post:24

Points:168
Posted on    October-14-2013 3:39 AM

 JQuery JQuery 
Ratings:


 1 Reply(s)
 905  View(s)
Rate this:

I am using jQuery JavaScript library. I like the event listener .ready(); what fires when the DOM is set up.

( Pretty similar to .onload )

I would find it very useful, if there was an event listener wich has a very similar behaviour to this, but fires when an element is fully loaded. (f.e.: Picture, a Div, such )

I would appreciate both jQuery or JavaScript methods too.

Thanks.



Hank Greenberg
Hank Greenberg

Total Post:12

Points:84
Posted on    October-14-2013 4:06 AM

All elements (including div and img) are ready as soon as DOMReady fires - that's what it means.

However, you can use the load() event to run some code when an img tag has fully loaded the image in it's src attribute:

$('img').load(function() {
   console.log('image loaded');
});

Don't want to miss updates? Please click the below button!

Follow MindStick