JSFiddle - React, Tailwind, and code Playground

HTML

<div id="first">
    <div id="second"></div>
</div>

CSS

#first {
    width: 200px;
    height: 200px;
    background-color: red;
}
#second {
    width: 100px;
    height: 100px;
    background-color: green;
}

JavaScript

$("p").click(function () {
    $(this).hide();
})

$("#second").click(function (e) {
    e.stopPropagation();
    
    alert("second.");
});

$("#first").click(function () {
    alert("first.");
});