Event: stopPropagation() method
{{APIRef("DOM")}}
{{AvailableInWorkers}}
The stopPropagation()
method of the {{domxref("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. If you want to stop those behaviors, see
the {{domxref("Event.preventDefault", "preventDefault()")}}
method. It also does not
prevent propagation to other event-handlers of the current element. If you want to stop those,
see {{domxref("Event.stopImmediatePropagation", "stopImmediatePropagation()")}}
.
Syntax
stopPropagation()
Parameters
None.
Return value
None.
Examples
See Event Propagation.
Also see the example at {{domxref("Event.stopImmediatePropagation", "stopImmediatePropagation()")}}
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}