JSFiddle - React, Tailwind, and code Playground
by Amandeep Singh
HTML
<input class="comment_function" value="comment_function" type="button"/>
<div class="comment_confirm"> div: comment_function </div>
JavaScript
$(document).ready(function () {
$(document).on("click", function (e) {
if (!$(".comment_function").closest(".comment_confirm").length) {
if ($(".comment_confirm").is(":visible") ) {
$(".comment_confirm").hide();
}
}
//});
// $(document).click(function(e){ // hide list if clicked outside
if($(e.target).is('.comment_function'))
$(".comment_confirm").show();
});
});