Thursday, September 8, 2016

Show alternate image if source image is not found

To make an image showing alternate source when the main one is not found, you simply bind the onerror event on the image like the following:

<img src="imagenotfound.gif" alt="Image not found" onerror="this.onerror=null;this.src='imagefound.gif';" />


Reference: http://stackoverflow.com/questions/3984287/how-to-show-alternate-image-if-source-image-is-not-found-onerror-working-in-ie