HTML DOM Element addEventListener()
HTML DOM Element addEventListener() Method
The addEventListener() method is used for attaching an event handler to an element.
Syntax:-
Its syntax is:- element.addEventListener(event, function, useCapture)
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. |