JSFiddle - React, Tailwind, and code Playground
by dirtyd77
HTML
<img id="img" height="50" />
JavaScript
$(function () {
$("img").each(function () {
var element = $(this),
src = "http://google.com/images/srpr/logo4w.png"
if (src) {
$.when(
$.loadImage(src)
).then(function () {
element.attr("src", src);
console.log(element);
}, function () {
element.attr( "src", "error.png" );
}).done(function () {
element.fadeIn();
});
}
});
});