HTML DOM Document addEventListener()
HTML DOM Document addEventListener() Method
The addEventListener() method is used for attaching an event handler to a document. We can attach the event to every element in the HTML Document.
Syntax:-
Its syntax is:- document.addEventListener(event, function, Capture)
Further Explanation:-
Parameter | Description |
event | Required. The event name is like click and dblclick. |
function | Required. The function to run when the event occurs. |
capture | true - Execute in capturing phase.false - Execute in the bubbling phase. |