JSFiddle - React, Tailwind, and code Playground

by sushanth009

HTML

<div class="popupstyle">
    <a href="#">Hello</a>
</div>

CSS

.popupstyle
{
    width: 50px;
    height: 50px;
    background-color:red;
}

JavaScript

$(window).load(function() {
    $('.popupstyle').live("click", function(e) {
        console.log(e.target)
        if(e.target.tagName == 'A'){
            alert('You Clicked the Link Inside the Div');
            e.preventDefault();
        }
        else{
            alert('You Clicked on the div');
            return false;
        }
    });
});
$(document).ready(function() {
    $(window).click(function() {
        $('.popupstyle').hide();
    });
});