June 2025
Beginner
817 pages
31h 30m
English
An event handler is a JavaScript statement or function that gets executed when a specific JavaScript event is triggered (or fired). It’s relatively easy to set up an event handler for an event, and you have three options for doing so, which I’ll describe in the following three sections.
You’ve already seen several times in this chapter how you can set up an event handler as an HTML attribute. The principle is simple and clear, and the script can be called when the HTML document gets loaded, if the HTML element has already been loaded.
In the following line, event handler changeColor() has been set up for HTML element ...
Read now
Unlock full access