Events

TRADITIONAL DOM EVENT HANDLERS

All modern browsers understand this way of creating an event handler, but you can only attach one function to each event handler.

event

USING DOM EVENT HANDLERS

event example

EVENT LISTENERS

Event listeners are a more recent approach to handling events. They can deal with more than one function at a time but they are not supported in older browsers.

even l

THE EVENT OBJECT

When an event occurs, the event object tells you information about the event, and the element it happened upon.

even object

EVENT DELEGATION

Creating event listeners for a lot of elements can slow down a page, but event flow allows you to listen for an event on a parent element.

event d