-
Notifications
You must be signed in to change notification settings - Fork 22.5k
/
index.md
44 lines (30 loc) · 1.19 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---
title: "Event: stopPropagation() method"
short-title: stopPropagation()
slug: Web/API/Event/stopPropagation
page-type: web-api-instance-method
browser-compat: api.Event.stopPropagation
---
{{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
event.stopPropagation()
```
### Parameters
None.
### Return value
None.
## Examples
See [Event Propagation](/en-US/docs/Web/API/Document_Object_Model/Examples#example_5_event_propagation).
Also see the example at {{domxref("Event.stopImmediatePropagation", "stopImmediatePropagation()")}}
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}