title: Prevent Form submitting and hitting keyup event handler not working
body: <p>Having some problem cross browser. I need to Support IE7-9, my site is set to IE7 standards - cannot be changed. Then i need to support latest chrome, safari and firefox.</p>
  
  <p>I want to hit a keyup event in a textbox on enter. Problem is i have a keypress event added to the form on that page which is submitting the form which i dont want to happen.
  Sample application would be like this.</p>
  
  <p><strong>JAVASCRIPT:</strong></p>
  
  <pre><code>$(document).ready(function () {
  
          $("form").bind("keypress", function (e) {
              var code = (e.keyCode ? e.keyCode : e.which);
              if (code == 13) {
                  $("#log1").append("Key press - Form event");
              }                
          });
  
          $("#myInput1").bind("keypress", function (e) {
              var code = (e.keyCode ? e.keyCode : e.which);
              if (code != 13) {
                  return true;
              }
  
              $("#log2").append("Enter pressed - input event");
  
              //if (!e) var e = window.event;
  
              e.cancelBubble = true;
              e.returnValue = false;
  
              if (e.stopPropagation) {
                  e.stopPropagation();
                  //e.preventDefault();
              }
  
          });
  
          $("#myInput1").bind("keyup", function (e) {
              var code = (e.keyCode ? e.keyCode : e.which);
              if (code != 13) {
                  return true;
              }
  
              $("#log1").append("Key up - Enter pressed - input event");
          });
  
  
      });​
  </code></pre>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;li onkeypress="alert('hi')"&gt;
              &lt;input id="myInput1" type="text" /&gt;
              &lt;div id="log1"&gt;&lt;/div&gt;
              &lt;div id="log2"&gt;&lt;/div&gt;
          &lt;/li&gt;
  </code></pre>
  
  <p>If i use e.preventDefault() - keyup event is not hit, if i dont use it, page is posting back.</p>
  
  <p>I want to see "Key up - Enter pressed - input event" to be written to screen on pressing enter, across all browsers. </p>
  
  <p>Any help would be appreciated. Thank you.</p>