JSFiddle - React, Tailwind, and code Playground
HTML
<div>
<a href="#">Click me (should be ignored)</a>
</div>
CSS
div {
background:red;
padding:50px;
}
a {
display:block;
color: white;
text-align:center;
text-decoration:none;
margin-bottom:20px;
}
JavaScript
//$('body').on('click', ':not(a)', function () {
// alert('got a click');
//});
$("body").click(function(e) {
if($(e.target).is('a')){
e.preventDefault();
return;
}
alert('got a click');
});