Get the Newsletter

addEventListener

A Method

addEventListener(eventName: string, callback: EventListenerOrEventListenerObject, capture: boolean): void

Add an event listener to the document.

Parameters

eventName: string
A string representing the event type to listen for.
callback: EventListenerOrEventListenerObject
The function or listener object that receives a notification when an event of the specified type occurs.
capture: boolean
If true, useCapture indicates that the user wishes to initiate capture.