Registers an event handler for the specified event type.
Method of dom/EventTargetdom/EventTarget
Syntax target.addEventListener(type, handler, useCapture);
Parameters type
The type of event type to register.
handlerA function that is called when the event is fired.
useCapture(Optional)
A Boolean value that specifies the event phase to add the event handler for.
While this parameter is officially optional, it may only be omitted in modern browsers.
Return ValueNo return value
ExamplesThis example listens to any click events on the document or its descendants.
document.addEventListener(
"click",
function (e) {
console.log("A " + e.type + " event was fired.");
},
false);
Notes
Microsoft Developer Network: [Windows Internet Explorer API reference Article]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4