title: Event binding clicks with backbone.js & jQuery
body: <p>I need to bind two events in my <code>backbone.js</code>-view in order to toggle a menu. The idea is that if a button with the id <code>#toggler</code> is clicked the menu appears and any click outside the <code>#menu</code> element will hide the menu.</p>
  <p>Unfortunately I cannot get this working with backbone's event binding without having the <code>outsideMenuHandler()</code> called on every click regardless if I clicked on the <code>#menu</code> element, or not.</p>
  <p>What should I change to make this work?</p>
  <p><strong>This is what I have done in backbone.js, which doesn't work as intended:</strong></p>
  <pre><code>myView = Backbone.View.extend({
  
      events: {
          'click #menu': 'insideMenuHandler',
          'click':       'outsideMenuHandler'
      }
  
      insideMenuHandler: function(e) {}, // Called when clicking #menu
      outsideMenuHandler: function(e) {} // Called on every click both on and off #menu
  
  }
   
  </code></pre>
  <p><strong>Just as a reference, here's what I would do using jQuery alone:</strong></p>
  <pre><code>$(document).click(function(event) {
      if ( $(event.target).closest('#menu').get(0) == null ) {
          $(&quot;#menu&quot;).slideUp();
      }
  });   
  </code></pre>