title: Is is possible to bind a submit() function before any existing onsubmit/submit?
body: <p>I have a form with an <code>onsubmit</code> attribute. I need to bind a new submit event and I need this one to be executed before any existing submit functions.</p>
  
  <p>The following code demonstrates the problem.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;title&gt;Test&lt;/title&gt;
      &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
        jQuery(function($) {
          // a plugin
          $('form').submit(function() {
            alert("Second");
          });
          // an other plugin
          $('form').submit(function() {
            alert("Third");
          });
  
          // this event must always be executed as first event
          $('form').submit(function() {
            alert("Always First");
          });
        });
      &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;form onsubmit="javascript:alert('Fourth');"&gt;
        &lt;p&gt;
          &lt;input type="submit"&gt;
        &lt;/p&gt;
      &lt;/form&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>If you execute the script, first you get "Second", then "First".</p>
  
  <p>Is is possible to bind a new submit event and specify whether the function must be called before any existing event?</p>
  
  <p>Constraints:</p>
  
  <ul>
  <li>Existing events must be preserved.</li>
  <li>I can't remove existing events because the content of the <code>onsubmit</code> attribute contains a quite complex logic written by Rails</li>
  <li>(ADDED): the event should always be executed before any existing onsubmit event and already binded events (perhaps binded by an other plugin)</li>
  </ul>
  
  <p>Any idea?</p>