JSFiddle - React, Tailwind, and code Playground
HTML
<div id="parent" style="width: 100%; height: 100%; background-color:red;" />
<h1>I'm the parent!</h1>
<div id="child" style="width: 300px; height: 200px; background-color:yellow;">
</h2>..and I'm the child!</h2>
</div>
</div>
JavaScript
$(document).ready(function(){
$('#parent').click(function(event){
if(this === event.target) {
alert('Parent was clicked');
}
});
});