JQUERY.READY() EQUALENT EVENT LISTENER ON ELEMENTS?

Kate Smith

Total Post:24

Points:168
Posted by  Kate Smith
JQuery 
 1177  View(s)
Ratings:
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.

  1. Hank Greenberg

    Post:12

    Points:84
    Re: jQuery.ready() equalent event listener on elements?

    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');
    });

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!