title: How to prevent other event handlers, from first handler, in jQuery
body: <p>If you attach two or more event handlers to an HTML element, they would be executed one after the other. However, if you want to stop the subsequent event handlers, based on a condition checked in the first handler, then what you should do?</p>
  
  <p>For example:</p>
  
  <pre><code>&lt;div id='target'&gt;
  &lt;/div&gt;
  
  &lt;p id='result'&gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>I'd like to cancel the second handler, if the first handler is cancelled.</p>
  
  <pre><code>$(function() {
      var target = $('#target'),
          result = $('#result');
      target.click(function(e) {
          result.append('first handler&lt;br /&gt;');
          // Here I want to cancel all subsequent event handlers
      });
      target.click(function(e) {
          result.append('second handler&lt;br /&gt;');
      });
  });
  </code></pre>
  
  <p>You can see the fiddle <a href="http://jsfiddle.net/saeedneamati/pFp7P/">here</a>.</p>
  
  <p>PS: I know that <code>e.preventDefault()</code> prevents the default action of the HTML element (for example, preventing an HTTP GET request being sent because of the click on a link), and <code>e.preventPropagation()</code> causes the event from being propagated to its parent elements in the DOM tree. I also know that it's possible to use a middle variable, set it to true in first handler, and check it in subsequent handlers. But I want to see if there is a more neat, sophisticated solution to this problem or not.</p>