javascript - I want to use an onload function on an image in Jquery -


i need check when image loaded. result has this:

  $('.testimage').onload(function() {   // stuff   }); 

all appreciated.

there no onload method in jquery (although there underlying onload property on raw dom). there load method (confusingly) has different meanings (see http://api.jquery.com/load-event/ , http://api.jquery.com/load/ ) depending on context use in, , version attaches load event handler has been deprecated.

the standard jquery way attach event handlers via on method:

  $('.testimage').on('load', function() {       // stuff   }); 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -