1<!-- hide image if not find -->
2<img src="image.png" onerror="this.style.display='none'"/>
3
4<!-- show image after load -->
5<img src="image.png" style="display: none" onload="this.style.display=''">
1 $('img').on('error', function(){
2 $(this).hide();
3 });
4
5 /*// OR replace
6 ---------------------------*/
7 $('img').on('error', function (){
8 $(this).attr('src', '/path/to/image/default.png');
9 });