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: How to order events bound with jQuery, but it does not work.
Here's what I have:
$('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');
});