JSFiddle - React, Tailwind, and code Playground
HTML
<button id=butt>Show text</button>
<div id=result><!-- here goes generated html --> </div>
JavaScript
$("#butt").click(function(){
$("#result").html("<div id=temp>Click to hide</div>") ;
$("#temp").click(function(){
$("#temp").hide();
});
});