Image not found
Code that loads another image when the one you want can’t be found. I will tell you, this one takes a little while to work because the browser really wants to load the right image so it takes a little while before it will quit.
ImgNotFound.js
// hard way
<img src="img.jpg" onError="imgFix(this)">
function imgFix(e){
this.onerror=null;
var src = $(e).attr('src');
src = imgDir + src ;
e.src = src;
}
// easy way
<img src="img.jpg" onError="this.src='default.jpg'">