JSFiddle - React, Tailwind, and code Playground
by alnitak
HTML
<input type='button' id='click' value='Do'/>
JavaScript
(function($) {
$.fn.outerhtml = function() {
return $('<div/>').append(this.clone()).html();
};
})(jQuery);
$("#click").click(function(){
var $this = $(this);
var $imgDone = $('<img/>')
.attr({src: 'someImage/insomewhere.jpg'})
.insertAfter(this); // NB: not $this here
setTimeout(function(){
alert($imgDone.outerhtml());
}, 1000);
});