JSFiddle - React, Tailwind, and code Playground
by pleinx
HTML
<button>Again</button><hr />
<div class="form_wrapper">
Hello.
<div>How are you?</div>
</div>
CSS
.form_wrapper {
width: 100px;
height: 100px;
background: gray;
}
JavaScript
$(document).mouseup(function (e)
{
var container = $(".form_wrapper");
if (!container.is(e.target) && container.has(e.target).length === 0)
{
container.hide();
}
$("button").click(function(){
$(container).show();
});
});