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.
Written by Santiago Rojo
Related protips
4 Responses

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
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Html
Authors
Related Tags
#html
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#