JSFiddle - React, Tailwind, and code Playground

by Vinay Pratap Singh Bhadauria

HTML

<div>main div starts
    <br/>
    <br/>
    <br/>
    <br/>
    <div id="test">testing div click outside this</div>
    <br/>
    <br/>
    <br/>
    <br/>main div ends</div>

CSS

#test {
    height:100px;
    width:50px;
    background-color:red;
}

JavaScript

$(document).click(function(event) {
    if (event !== ("#test")) {
        ("#test").hide();
    }
});