Home >Web Front-end >JS Tutorial >Jquery stops event bubbling event.stopPropagation_jquery
Description: Prevent events from bubbling up the DOM tree, that is, event handlers on any predecessor elements are not triggered.
version added: 1.0
event.stopPropagation()
We can use event.isPropagationStopped() to determine whether this method has been called (on that event object).
This method is also valid for custom events triggered by trigger().
Note that this does not prevent other event handlers on the same element from running.
Additional Notes:
Since the .live() method handles the event once it propagates to the top of the document, it is impossible for the live event to stop propagating. Likewise, .delegate() events will always be propagated to the contained delegated element; events on the element will be executed when the delegated event is called.
Example:
Stop the bubbling of click events.