title: How to bind to the submit event when HTML5 validation is used?
body: <p>Using HTML5 validation...</p>
  
  <p>In HTML5 browsers, validation occurs <em>before</em> the <code>submit</code> event. So if the form is invalid, the submit event never fires.</p>
  
  <p>I would like to hook an event into the form submit, to fire whether the form validates or not. Here's a small example, where I'm trying to <code>alert()</code> when the user submits the form.</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;&lt;title&gt;Example&lt;/title&gt;&lt;/head&gt;
      &lt;body&gt;
          &lt;form&gt;
              &lt;input type="text" name="foo" required title="Foo field"/&gt;
              &lt;input type="submit"/&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>JavaScript:</p>
  
  <pre><code>$(function() {
      $('form').submit(function() {
          alert('submit!')
      });
  });
  </code></pre>
  
  <p>Interactive demo: <a href="http://jsfiddle.net/gCBbR/" rel="noreferrer">http://jsfiddle.net/gCBbR/</a></p>
  
  <p>My question is: <strong>do browsers provide an alternative event that I can bind to that will run before the validation?</strong></p>