replace broken images with a default image

Solutions on MaxInterview for replace broken images with a default image by the best coders in the world

showing results for - "replace broken images with a default image"
Savannah
26 Feb 2016
1$('img').on('error', function (){
2	$(this).attr('src', '/path/to/image/default.png');
3});
4
5/*// OR hide
6---------------------------*/
7$('img').on('error', function(){
8	$(this).hide();
9});