JSFiddle - React, Tailwind, and code Playground

HTML

<html>
<head>
 
 
</head>
 
<body>
 
<h1>Check if image is loaded jQuery</h1>
<p>
<img id="image1" 
src="http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif"/>
<p>Load image from 
"http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif"</p>
 
<span id="result1"></span>
</p>
 
<p>
<img id="image2" src="xxxx.jpg"/>
<p>Load image from "xxxx.jpg"</p>
 
<span id="result2"></span>
</p>
 </body>
</html>

CSS

span{
        padding:8px;
        border:1px solid red;
        color:blue;
    }

JavaScript

$("img").load(function(){
        $('#result1').text('Image is loaded!\n'); 
    })
    .error(function(){
        $('#result1').text('Image is not loaded!\n');
            // in this case you must reload image with jQuery
            var imgSrc = $(this).attr('src');
            $(this).attr('src',imgSrc);
    });