JSFiddle - React, Tailwind, and code Playground

HTML

<div id="rl_menu"></div>

CSS

#rl_menu
{
  width: 50px;
 height: 50px;
 background: green;   
}
body, html
{
 height: 100%;   
}

JavaScript

$(function(){
    
    $("body").click(function(e){
        var t = $(e.target);
        if( !t.is("#rl_menu") && t.closest("#rl_menu").length == 0)
        {
            alert("CLICKD OUTSIDE THE GREEN")
        }
    });
});