How To Hide Image Broken Icon

Many web designers & developers get an issue of broken image (" ") on the website.

The broken image are a common error. 

It gives an error because the image is not there in the directory/folder or the path of the IMG is not proper.

On website, it shows a broken image icon.

You can hide the broken icon with the help of a attribute in the HTML in IMG tag.

<img src="error.jpg" onerror="this.style.display='none'"/>

In every IMG tag use the attribute " onerror ".

The attribute has a element " this.style.display='none' ".

This attribute helps to hide the broken image icon.


6th-April-2021

Adarsh Vishwakarma


Share the Post

Feedback

Comment

Leave a Comment