I’m trying to bind two submits events, and prevent the second one.
Example:
$('form').submit(function(event){
alert(1);
//if some condition cut the submit events
event.preventDefault();
return false;
});
$('form').submit(function(){
alert(2);
return false;
});
Here’s the example http://jsfiddle.net/da3aB/
You need to call
event.stopImmediatePropagation()to tell jQuery not to call other events that were registered for that element.Demo