JSFiddle - React, Tailwind, and code Playground

HTML

<input type='button' id='click' value='Do'/>

JavaScript

$("#click").click(function(){
        var $imgDone = $('<img/>').attr('src', 'img/pedidos_compra/fail.png');
                $(this).after($imgDone);
                setTimeout(function(){
                    alert($(this).next().html());
                }, 1000);
});