Event: stopPropagation() method

فهرست فصل‌ها دانلود آرشیوناشر

MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونه‌کد

{{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

js-nolint
stopPropagation()

Parameters

None.

Return value

None.

Examples

See Event Propagation. Also see the example at {{domxref("Event.stopImmediatePropagation", "stopImmediatePropagation()")}}

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}