How to silently hide "Image not found" icon when src source image is not found

systempuntoout picture systempuntoout · Jul 13, 2010 · Viewed 85.6k times · Source

Do you know how to hide the classic “Image not found” icon from a rendered HTML page when an image file is not found?

Any working method using JavaScript/jQuery/CSS?

Answer

Gary Willoughby picture Gary Willoughby · Jul 13, 2010
<img onerror='this.style.display = "none"'>