JSFiddle - React, Tailwind, and code Playground

by jashwant

HTML

<div id="div1">
     
</div>

CSS

#div1
{
    width: 100px;
    height: 100px;
    background-color: orange;
    position: absolute;
    top: 20%;left : 30%;
}

JavaScript

$(function() {
    $(document).on('click', function(e) {
        if (e.target.id == 'div1') {
            alert('Div Clicked !!');
        } else {
            $('#div1').toggle();
        }

    })
});