Return to Snippet

Revision: 54703
at January 8, 2012 09:47 by FatFolderDesigner

Initial Code
// Safe Snippet
$("img").error(function () {
	$(this).unbind("error").attr("src", "missing_image.gif");

// Persistent Snipper
$("img").error(function () {
	$(this).attr("src", "missing_image.gif");

Initial URL

Initial Description
There are 2 jQuery snippets, both replace broken images with one of your choosing, the difference is that one is "safe" and the other is "persistent". The safe one will quick working, so if your doing something that dynamically changed images on a page it'll only work for the first broken image. The persistent one will keep working, but if your missing image image is missing it'll cause a overflow error.

Initial Title
Auto-Replace Broken Images

Initial Tags
javascript, images

Initial Language