title: Insert a JQuery click handler that executes before the ones already registered
body: <p>I want to attach a click event handler to each and every (Button, Anchor, Select) on all pages  in my application, and that handler should run before the already attached handlers declared in html like <code>onclick="return SomeFunction('a','b');"</code>. </p>
  
  <p>I found a question on stackoverflow for prepending handlers, and that was what I wanted exactly, the link to the question is:-</p>
  
  <p><a href="https://stackoverflow.com/questions/1264954/jquery-prepend-click-handler">Jquery prepend click handler</a></p>
  
  <p>But, the above code is not working, I doubt if it worked for the asker or not. The code I have written according to my requirements is:-</p>
  
  <pre><code>&lt;input type="button" value="Click 1" onclick="f2();" /&gt;
  
  $(document).ready(function() {
              $("input[type=button]").each(function() {
  
                  // your button
                  var btn = $(this);
  
                  // original click handler
                  var clickhandler = btn.attr("onclick");
                  btn.attr("onclick", "return false;");
  
  
                  // new click handler
                  btn.click(function() {
                      alert('Prepended Handler');
                      clickhandler();
                  });
              });
          });
  
          function f2() {
              alert('Handler declared in HTML');
          }
  </code></pre>
  
  <p>The output for this code should have been: An alert showing "Prepended Handler" and then a next alert showing "Handler declared in HTML".</p>
  
  <p>But, the actual result is: Only the first alert is appearing and the second one is not.</p>
  
  <p>Please tell me if you see any problem in this code. </p>
  
  <p>And, how can this be done. ?</p>