
Sir
My web page contains a lot of images. But when it will not loaded properly, it shows a broken image.
How can I fix it so that broken image will be replaced by error image automatically. Please Mention code.
Best regards

Dear friend
Use the following code :
$(window).bind('load', function() { $('img').each(function() { if((typeof this.naturalWidth != "undefined" && this.naturalWidth == 0 ) || this.readyState == 'uninitialized' ) { $(this).attr('src', 'missing.jpg'); } }); })
This code will replace the broken image with default image set by you.

$(document).ready(function(){ $("img").each(function(index) { $(this).error(function() { $(this).unbind("error").attr("src", "/images/NoImage.png"); // If you want to replace with any blank image.
$(this).hide();//You can simply Hide it using this.
});
$(this).attr("src", $(this).attr("src"));
});
});
You may have more details available HERE
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.