35 - addEventListener | Events in JavaScript

Опубликовано: 24 Октябрь 2024
на канале: GoPHP
316
7

addEventListener() method attaches an event handler to the document
document.addEventListener(event, function, useCapture)
event: Required. A String that specifies the name of the event.
function: Required. Specifies the function to run when the event occurs.
useCapture:
Optional. A Boolean value that specifies whether the event should be executed in the capturing or in the bubbling phase. Possible values:
true - The event handler is executed in the capturing phase
false- Default. The event handler is executed in the bubbling phase