September 2024
Beginner to intermediate
985 pages
35h 37m
English
Events in JavaScript (and in event-driven programming in general) can be triggered not only by immediate user actions, but also programmatically—that is, by JavaScript code.
To programmatically trigger an event, simply create an object instance of Event and use it as an argument to the dispatchEvent() method available to any element in the DOM tree.
The first argument passed to the Event constructor is a string that defines the type of the event. Optionally, a configuration object passed as the second argument can be used to determine whether the event should go through the bubbling phase or not (via the bubbles property) and whether it is allowed to prevent the browser's ...
Read now
Unlock full access