C H A P T E R 30
Working with Events
I have been using events in the examples for this part of the book to respond to button clicks. In this chapter, it is time to dig into the details, explain what events really are, show you how they work, and how they fit within the rest of the DOM. In short, events allow you to define JavaScript functions that are invoked in response to a change in the state of an element, such as when the element gains and loses the focus, or when the user clicks the mouse button over the element.
In this chapter, I focus on introducing the event mechanism and the events defined by the document
and HTMLElement
objects. These are the events that are used most often and apply to all documents and elements. Table 30-1 provides ...
Get The Definitive Guide to HTML5 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.