TOP
EN EL
Images - Fix broken images
20 August 2024 Published by Aristotelis Pitaridis
Tools used for this tutorial
jQuery 3.7.1
SHARE

Sometimes one ore more images have broken links so the image does not appear on the screen. In that case we can use the following code so that we will replace them with a different image.

$('img').error(function() {
    $(this).attr('src', '/images/broken.png');
});