How can I run code right before the jQuery submit() executes?
<p>Basically, I have a form and a validation function that executes when a form is submitted. However, I want some other codes to run before the validation runs. I tried this: <a href="http://stackoverflow.com/questions/290254/how-to-order-events-bound-with-jquery">How to order events bound with jquery</a>, but it does not work.</p>

<p>Here's what I have:</p>

<pre><code>  $('form').submit(function(){
    $('form').trigger('before-submit');

    if($(this).find('error').exists(event))
      event.preventDefault();
  });


  $('form').bind('before-submit', function(e) {
    if($('#url').val=='http://')
      $('#url').val('');
      alert('test');
  });
</code></pre>
