I have defined the image tag with a background color so that if there is no image the color should show but still the broken image icon is showing how to remove that ?
I dont want to make the page bulky by adding jquery or any framework , also i cant add any kind of divs to images because the site is almost done.
Found the answer with only javascript
function ImgError(source){
source.src = "/images/noimage.gif";
source.onerror = "";
return true;
}
<img src="someimage.png" onerror="ImgError(this);"/>
you can hide that using following:
you can display another image if image not found as follow: