$("div#foobar").live('click', function() {
});
$(window).hashchange(function() {
});
How can I stop firing hashchange
event when ever click
event fires.
Note On click event I am firing an ajax and changing the hash ... And on hashchange I am doing something. Since Click event also changes the hash so hashevent fires. So, I want that whenever click event fires hashchange should not be fire ..
stopPropagation() The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases. It does not, however, prevent any default behaviors from occurring; for instance, clicks on links are still processed.
stopPropagation() Event Method The stopPropagation() method prevents propagation of the same event from being called. Propagation means bubbling up to parent elements or capturing down to child elements.
If you want to stop the event bubbling, this can be achieved by the use of the event. stopPropagation() method. If you want to stop the event flow from event target to top element in DOM, event. stopPropagation() method stops the event to travel to the bottom to top.
stopPropagation()Returns: undefined. Description: Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event.
stop propagation and prevent default behavior.
$("div#foobar").live('click', function(event) {
event.stopPropagation();
event.preventDefault()
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With