JSFiddle - React, Tailwind, and code Playground

HTML

<div class="parent">
    <div class="child"></div>
    <div class="child"></div>
</div>

CSS

.parent{
    width:200px;
    height:200px;
    border:1px solid #888;
}
.child{
    height:20px;
    background:#ccc;
    margin:2px;
}

JavaScript

$( '.parent' ).click(function ( e ) {
    if ( $( e.target ).is( '.child' ) ) {
        alert( 'child click' );
    } else {
        alert( 'parent click' );
    }    
});