EventTarget.addEventListener()
The modern standard API for adding DOM event handlers. Introduced in the DOM Level 2 Events spec. Also implies support for the capture phase of DOM event dispatch, as well as the stopPropagation()
and preventDefault()
event methods.
IE | Edge | Firefox | Chrome | Safari | Opera | iOS Safari | Opera Mini | Android Browser | Blackberry Browser | Opera Mobile | Chrome for Android | Firefox for Android | IE Mobile | UC Browser for Android | Samsung Internet | QQ Browser | Baidu Browser |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
49 | |||||||||||||||||
56 | 9.3 | 4.4 | |||||||||||||||
14 | 52 | 57 | 10 | 10.0-10.2 | 4.4.3-4.4.4 | 4 | |||||||||||
11 | 15 | 53 | 58 | 10.1 | 44 | 10.3 | all | 56 | 10 | 37 | 57 | 52 | 11 | 11.4 | 5 | 1.2 | 7.12 |
54 | 59 | TP | 45 | ||||||||||||||
55 | 60 | 46 | |||||||||||||||
56 | 61 |
Notes
-
1
IE<=8 instead only supports the proprietary
.attachEvent()
method. It also does not support the capture phase of DOM event dispatch; it only supports event bubbling. -
2
The
useCapture
parameter is non-optional and must be provided. Future versions made it optional, with a default value offalse
.