Using jQuery, this snippet shows how to handle an image 404 event. It expects the image tag to provide both the width and height attributes. These help to define the dimensions of the replacement "stub" div in place of the missing image.
jQuery 1.8.3, HTML, CSS, JavaScript
No-Library (pure JS), HTML, CSS, JavaScript
jQuery 1.3.2, HTML, CSS, JavaScript