If you attach two or more event handlers to an HTML element, they would be executed one after the other. However, if you want to stop the subsequent event handlers, based on
See event.stopImmediatePropagation()
- http://api.jquery.com/event.stopImmediatePropagation/
According to the jQuery API docs, this method:
Keeps the rest of the handlers from being executed and prevents the event from bubbling up the DOM tree.
The solution is browser specific. See dojo.stopEvent
:
dojo.stopEvent = function(/*Event*/ evt){
// summary:
// prevents propagation and clobbers the default action of the
// passed event
// evt: Event
// The event object. If omitted, window.event is used on IE.
if(has("dom-addeventlistener") || (evt && evt.preventDefault)){
evt.preventDefault();
evt.stopPropagation();
}else{
evt = evt || window.event;
evt.cancelBubble = true;
on._preventDefault.call(evt);
}
};
Updated fiddle: http://jsfiddle.net/pFp7P/1/