JSFiddle - React, Tailwind, and code Playground

by Emre Erkan

HTML

<img src="http://cdn0.hark.com/images/000/007/098/7098/original.0" />
<input type="button" id="test" value="change" />

JavaScript

$('img').load(function() {
    alert(1);
});
$('#test').click(function() {
    $('img').prop('src', ((new Date()) % 2 == 0 ? 'http://ozonlinecarsales.com.au/uploadedimages/8812066bill-gates-car.jpg' : 'http://static.howstuffworks.com/gif/smart-car-1.jpg'));
});