I am trying to implement a jquery-ui menu that appears when an object is clicked but disappears when a click is made anywhere other than on the menu itself.
This is the code I have so far:
$("div.item").click(function(e){
        $( "#menu" ).menu( );
        $("#menu").css("top",e.pageY);
        $("#menu").css("left",e.pageX);
        
       });
Now I want to hide and destroy the menu if a click is made anywhere other than on the menu itself.
 
     
     
     
     
     
     
    