Chapter 7Events
We saw in the last chapter how the DOM API links the JavaScript language to web pages. Events are another part of the DOM API and they are what provides the link between the web page and user interactions. Every time a user interacts with a web page, such as clicking on a link, pressing a key, or moving a mouse, an event occurs that our program can detect and then respond to.
In this chapter, we’ll cover the following topics:
-
introduction to events
-
adding event listeners
-
the event object
-
mouse, keyboard and touch events
-
removing event listeners
-
stopping default behavior
-
event propagation
Event Listeners
Imagine that you’re waiting for a really important email message that you need to act upon as soon as it arrives, but ...
Get JavaScript: Novice to Ninja now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.