function imageLoadError(img) { const fallbackImage = ‘/media/sites/cnn/cnn-fallback-image.jpg’; img.removeAttribute(‘onerror’); img.src = fallbackImage; let element = img.previousElementSibling; while (element && element.tagName === ‘SOURCE’) { element.srcset = fallbackImage; element = element.previousElementSibling; } } • Video 3:05 Ronny Hartmann/AFP/Getty Images


Categories :

function imageLoadError(img) {
const fallbackImage = ‘/media/sites/cnn/cnn-fallback-image.jpg’;

img.removeAttribute(‘onerror’);
img.src = fallbackImage;
let element = img.previousElementSibling;

while (element && element.tagName === ‘SOURCE’) {
element.srcset = fallbackImage;
element = element.previousElementSibling;
}
}


Video

3:05

Ronny Hartmann/AFP/Getty Images

Leave a Reply

Your email address will not be published. Required fields are marked *