JSFiddle - React, Tailwind, and code Playground

by Seetpal Singh

HTML

<div id='clickable_drop'><div>Click here</div>
    <div>Successfully clicked inside <br/> Now click outside </div>
</div>

JavaScript

$(document).click(function (e)
{
    var container = $("#noty_topRight_layout_container");
    var cont = $("#chnoti");

    if (!container.is(e.target) && !cont.is(e.target) // if the target of the click isn't the container...
        && container.has(e.target).length === 0 && cont.has(e.target).length === 0) // ... nor a descendant of the container
    {
        container.find('li').remove();
    }
});