JSFiddle - React, Tailwind, and code Playground

by sushanth009

HTML

<div  class="hide"> 
    <span class="green" id="somediv"> YOOO </span>
</div>

CSS

.hide
{
    width: 100px;
    height: 100px;
    background-color: red;
}

.green
{
    width: 20px;
    height: 30px;
    background-color: green;
}

JavaScript

$('div').click(function(e) {
    if (e.target != this) {
        alert(((e.target.id) == 'somediv'));
    }
});