title: How to disable form submission when enter is pressed on input field
body: <p><strong>UPDATE: I am constructing the form via Javascript, so the form is not there on page load.</strong> </p>
  
  <p>I have an input field with <code>id="input"</code>, whenever the <code>enter</code> key is pressed, the form gets submitted. So I tried handling it like this. </p>
  
  <pre><code>$("#input").keydown(function (e) {
      if (e.keyCode == 13) {
          alert("enter pressed");
          return false;
      }
  });
  </code></pre>
  
  <p>However this does not work, there is no alert and the form still gets sent. How do I solve this?</p>