title: Stop one of click events on the same button
body: <p>I've button, with two click events on it.
  What I'm trying to do is to prevent both or all events on that button dependent on a criteria. </p>
  
  <p>I tried to use <code>event.preventDefault();</code> and <code>event.stopPropagation();</code> and <code>return false;</code> but nothing works as I need.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>/* I need to stop $('button') event if the if condition
  inside $('#btn') event passed */
  
  $('#btn').click(function(e){
    var term = $('#term').val();
  
    if(term != '') {
      //e.preventDefault();
      //e.stopPropagation();
      return false;
      alert(2);
    } else {
      // continue
    }
  });
  
  $('button').click(function(e){
    alert(1);
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;input id="term" type="text" placeholder="type here .."&gt;
  &lt;button type="button" id="btn"&gt;Check&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><a href="https://jsfiddle.net/1L8oevo4/1/" rel="nofollow">JSfiddle example</a></p>