JSFiddle - React, Tailwind, and code Playground
HTML
<img src="/my/image/path/foo/bar.jpg" />
JavaScript
$(document).on('error', 'img[src*="/image/path/"]', function() {
alert('error loading image ' + $(this).attr('src'));
});
$('body').on('error', 'img', function() {
alert('error loading image ' + $(this).attr('src'));
});