JSFiddle - React, Tailwind, and code Playground

HTML

<img src="fafav.jpg" id="img" />

JavaScript

$(function(){
    $('#img').error(function(){
        alert('error');
    });
});