title: jQuery, closing menu
body: <p>I need help with a menu I'm adding on a jQuery chat system called cometchat.
  I've been trying to add a Facebook like applications menu and I got it to work with opening and closing and it closes clicking everywhere in the body and the bar but the place it should open and close. </p>
  
  <p>Here is the piece of code:</p>
  
  <pre><code>a("#cometchat_base").append(
    '&lt;div id="cometchat_application" class="cometchat_application menu"&gt;
      &lt;strong&gt;Menu&lt;/a&gt;&lt;/strong&gt;
    &lt;/div&gt;');
  
  a("#cometchat_base").append(
    '&lt;div class="menu-content" style="
        display:none;
        position:absolute;
        bottom: 30px;
        left: 20px;
        border: 1px solid black;
        background-color:White;
        padding: 5px;"&gt;
      &lt;div&gt;
        &lt;a href="#"&gt;Menu option 1&lt;/a&gt;
      &lt;/div&gt;
      &lt;div&gt;
        &lt;a href="#"&gt;Menu option 2&lt;/a&gt;
      &lt;/div&gt;
    &lt;/div&gt;');
  
  a(".cometchat_application,.menu").click(function(){
    a(".menu-content").hide();
    a(this).next().show();
    return false;}
  );
  
  a("#page-bg,#cometchat_base,.menu-content a").click(function(){
    a(".menu-content").hide();}
  );
  
  a(".boo,.menu-content a").click(function(){alert(a(this));});
  </code></pre>
  
  <p>I tried to change <code>a("#page-bg,#cometchat_base,.menu-content a")</code> and add the button div class but then it wont open anymore. And the <code>alert(a(this);</code> I couldn't change so it just opens the link without any alerts.</p>