JSFiddle - React, Tailwind, and code Playground

JavaScript

$('<img src="invalidURL" />').error(function() {
    alert('img does not exist')
})