jQuery.ready() equivalent event listener on elements?

后端 未结 3 1978
不思量自难忘°
不思量自难忘° 2020-11-30 10:03

I am using jQuery JavaScript library. I like the event listener ready on $(document) that fires when the DOM is set up.

( Pretty similar

3条回答
  •  没有蜡笔的小新
    2020-11-30 10:36

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

提交回复
热议问题