JSFiddle - React, Tailwind, and code Playground

HTML

<ul id ="myUL">
<li>Click anywhere to initiate toggle handler <a href="#">(Except here)</a></li>
</ul>

CSS

div{
    width: 100px;
    height: 100px;
    background-color: red;
    position: absolute;
    left: 50px;
    top: 50px;
}

JavaScript

$(function(){
    $('#myUL li').bind('click', function(){
        alert('boh');
    });
    
   $('#myUL > li > a').bind('click', function(e){
     e.stopPropagation();
   });
});