JSFiddle - React, Tailwind, and code Playground
HTML
<div class="parent">
<div class="child">
<input type="button" onClick="alert('button');" />
</div>
</div>
CSS
.parent {
background: red;
padding: 50px;
}
JavaScript
$('.parent,.parent *').click(function (e) {
if ($(this).closest('.child').length <= 0) {
alert('parent');
}
e.stopPropagation();
});