• Prevent any propagation of the same event: function func1(event) { alert("DIV 1"); event.stopPropagation(); } Try it Yourself ». Description.
  • The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
  • event.stopPropagation(). The stopPropagation function stops bubbling at the element where this function is called.
  • These handlers, therefore, may prevent the delegated handler from triggering by calling event.stopPropagation() or returning false.
  • stopPropagation. Summary. Prevents propagation of an event beyond the current target. Method of dom/Event dom/Event. Syntax. event.stopPropagation()
  • The event.stopPropagation() method allows the element to avoid the execution of the parent event handlers for the specific element.
  • event.stopPropagation() - Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event.
    • event.stopPropagation() – It prevents the event from propagating (or “bubbling up”) the
    • Stops callback execution and returns immediately when called.
  • That is a parent event is called we can stop the propagation of calling its children by using the stopPropagation() method and vice-versa. Syntax
  • In this example, the 'stopPropagation' method is called when the button is clicked. This stops the event from propagating any further.