O'Reilly logo

The Definitive Guide to HTML5 by Adam Freeman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required