I want to do:
$(\"img\").bind(\'load\', function() {
// do stuff
});
But the load event doesn\'t fire when the image is loaded from cache
Just re-add the src argument on a separate line after the img oject is defined. This will trick IE into triggering the lad-event. It is ugly, but it is the simplest workaround I've found so far.
jQuery('
', {
src: url,
id: 'whatever'
})
.load(function() {
})
.appendTo('#someelement');
$('#whatever').attr('src', url); // trigger .load on IE