JSFiddle - React, Tailwind, and code Playground

HTML

<img id="myimg" src="someimg.jpg" alt="img" />
<div id="result"></div>

JavaScript

$('#myimg').error(function() {
    $('#result').html("image not found");
});