I'v searching for a way to hide a toggling div which is already hidden by default. I want to hide the div if user click outside of it!
I tried this:
<script> 
  $(document).ready(function(){ 
     $("#tab").hide();
     $("#open_tab").on("click",function(){
        $("#tab").toggle();    
        $("*").on("mouseup",function(e){
              var clicked=$(this).attr("id");
              if(clicked !="tab"){
                 e.stopPropagation();
                 $("#tab").hide();
              }
             else {
                   e.stopPropagation();
             }
        });
     });
}); </script>
But i don't know what's wrong with my code. Please can anyone help?
 
     
     
    