JSFiddle - React, Tailwind, and code Playground
HTML
<div>test</div>
<a>test Anchor</a>
<div class='containers'>test NO CLICK</div>
<a>test Anchor</a>
<div class='containers'><span>test NO CLICK - </span>testDIV NO CLICK</div>
<a>test Anchor</a>
JavaScript
$('body').on('click','*:not(.containers,.containers *)', function(){
alert('something on body was clicked that wasn\'t "element" or inside element');
});