title: How to hide a jquery ui menu when clicked anywhere else?
body: <p>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.</p>
  <p>This is the code I have so far:</p>
  <pre><code>$(&quot;div.item&quot;).click(function(e){
          $( &quot;#menu&quot; ).menu( );
          $(&quot;#menu&quot;).css(&quot;top&quot;,e.pageY);
          $(&quot;#menu&quot;).css(&quot;left&quot;,e.pageX);
          
         });
  </code></pre>
  <p>Now I want to hide and destroy the menu if a click is made anywhere other than on the menu itself.</p>