O'Reilly logo

The JavaScript PocketGuide by Lenny Burdette

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

11. Events

Events are hugely important to client-side programming. Without them, you couldn’t add interactivity to web pages beyond clicking links and submitting forms.

Using events is a matter of executing a function in response to an action or input. These functions are known as event listeners or event handlers. I prefer handler even though some method names use listener. (Would a function handle an event or listen for an event? The former makes more sense to me.)

You can add event handlers to page elements in two ways, and Internet Explorer throws a wrench into the works by providing a completely different event API from every other modern browser. Handling events properly across all browsers can be pretty tricky, but fortunately JavaScript ...

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