title: How do I pass a named function from an event
body: <p>So, I have a simple </p>
  
  <pre><code>$(document).on('#happyButton', 'click', function(event) {
      event.preventDefault();
      //more goes here... 
  });
  </code></pre>
  
  <p>and I'd like to turn that into something akin to:</p>
  
  <pre><code>doStuff = function(event) {
      event.preventDefault();
      //more goes here...
  }
  
  $(document).on('#happyButton', 'click', doStuff(event));
  </code></pre>
  
  <p>As to be able to place this code in separate places, and more importantly run this elsewhere:</p>
  
  <pre><code>$(document).off('#happyButton', 'click', doStuff(event));
  </code></pre>
  
  <p>Unfortunately, this gives me an error:</p>
  
  <pre><code>Uncaught TypeError: Cannot call method 'preventDefault' of undefined 
  </code></pre>
  
  <p>Now, the <em>right</em> answer is to "use backbone!" but this is a refactor of previous code and I don't have the weeks of luxury to refactor it all. I can also do a simple </p>
  
  <pre><code>$('#happyButton').off()
  </code></pre>
  
  <p>and I will as necessary, but I'd prefer the former as a cleaner solution.</p>
  
  <p>Does anyone have other ideas? Thanks.</p>