title: Prevent form submission when hitting Enter in MVC3 field
body: <p>I have an MVC3 form with a single field on it - I don't want the form to actually be submitted, but be used with ajax to return JSON data for display on the screen.</p>
  
  <p>I want to use a ViewModel/Form so that my validation with error messages is called and displayed relatively nicely, and I can also call remote validation as well.</p>
  
  <p>However, when the user is entering data in the field, they can hit Enter and the form submits - which posts to the controller and returns a new, clear page :(</p>
  
  <p>I have tried disabling the form submit - but it doesn't seem to work?</p>
  
  <pre><code>$(document).ready(function () {
  
      $('form').submit = function (e) {
          alert('submit');
           e.preventDefault();
          return false;
      };
  .....
  </code></pre>
  
  <p>I've also tried moving the button out of the form, but (as expected) that doesn't make any difference.</p>
  
  <pre><code>@using (Html.BeginForm())
      {
          @Html.ValidationSummary(true)
          &lt;div&gt;
              &lt;span class="editor-label"&gt;@Html.LabelFor(model =&gt; model.AccountNumber)&lt;/span&gt;
              &lt;span class="editor-field"&gt;@Html.TextBoxFor(model =&gt; model.AccountNumber, new { @id = "accountNumber", size = "15" })
                  @Html.ValidationMessageFor(model =&gt; model.AccountNumber)&lt;/span&gt;
          &lt;/div&gt;
      }
      &lt;div&gt;
          &lt;button type="button" id="generate" class="generate"&gt;
              Generate&lt;/button&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>How can I stop Enter submissing my form?</p>