Skip to content

Fix broken images automatically

Occasionally we have times when we have broken image links on our website and replacing them one by one isn’t easy, so adding this simple piece of code can save you a lot of headaches.

$('img').error(function(){
$(this).attr('src', 'img/broken.png');
});
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments