Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

REPLACE BROKEN IMAGES WITH A DEFAULT IMAGE

$('img').on('error', function (){
	$(this).attr('src', '/path/to/image/default.png');
});

/*// OR hide
---------------------------*/
$('img').on('error', function(){
	$(this).hide();
});
 
PREVIOUS NEXT
Tagged: #REPLACE #BROKEN #IMAGES #WITH #A #DEFAULT #IMAGE
ADD COMMENT
Topic
Name
3+5 =