Last Updated: August 15, 2019
·
16.3K
· Santiago Rojo

Use an alt image for img HTML tags

In case you need to load an alternative image instead to show the classic alt text. You can do this:

<img src="404.png" onerror="this.src='alt.png';" />

Also, you can do anything with Javascript, in case of onerror event.

4 Responses
Add your response

I cant see any code

over 1 year ago ·

What to do.I can't see the code

over 1 year ago ·

The bug is already fixed.

over 1 year ago ·

@blainesch you're absolutely right. I didn't thought about that, the alternative image should exist, the idea is to set a default image that you know.

over 1 year ago ·