I have a page with a lot of images that are generated server-side depending on user actions. And when image loads successfully I\'m happy, but when there is an error on the
$('#your_image')
.error(function(e) {
//add your unhappy code here
//unbind if needed
$(this).unbind('error');
})
.load(function(e) {
//add your happy code here
//unbind if needed
$(this).unbind('load');
})
;