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');
});
$("a").click(function( event ) {
event.stopPropagation();
// do nothing effectively
});