Articles

Affichage des articles du mars, 2015

How to replace broken images with JQuery?

Image
This morning, I found a very useful JQuery tip posted by StackOverflow's member Prestaul. Thanks to him, I discovered that some browsers expose an onerror event on the image tag! The onerror event is triggered if an error occurs while loading an external file (e.g. a document or an image). This is a great solution to replace broken images when they are not hosted on your own website.