I have an image in a HTML page:
If the image is not found o
Well you can try this.
<object data="URL_TO_Default_img.png" type="image/png">
<img src="your_original_image.png" />
</object>
this worked for me. let me know about you.
I added a parent div around the image and used the following onerror event handler to hide the original image because in IE there was still an ugly image-not-found image shown after using the alt attribute:
<div style=" width:300px; height:150px; float:left; margin-left:5px; margin-top:50px;">
<img src='@Url.Content("~/Images/Logo-Left.png")' onerror="this.parentElement.innerHTML = '';" />
</div>
I wanted to hide the space occupied by <img>
tag so this worked for me
<img src = "source.jpg" alt = "" >
Solution - I removed the height and width elements of the img and then the alt text worked.
<img src="smiley.gif" alt="Smiley face" width="32" height="32" />
TO
<img src="smiley.gif" alt="Smiley face" />
Thank you all.