JSFiddle - React, Tailwind, and code Playground

by doug65536

HTML

<div id="container">
    Click in here, the event handler will ignore it: <input>
    
    <br>Click here, it will handle it
</div>

CSS

#container {
    width: 600px;
    height: 200px;
    border: solid black 1px;
}

JavaScript

$('#container').on('click', function(e) {
    if ($(e.target).is(this)) {
        $('body').append($('<p/>').text('you actually click the div, not a child'));
    }
});