In this chapter, we have learned the following:
• Events occur when a user interacts with a web page.
• An event listener is attached to a node, watches for an event to happen and then in-
vokes a callback function.
• The event object is passed to the callback function as an argument, and contains lots
of properties and methods about the event.
• There are many types of event, including mouse events, keyboard events, and touch
• You can remove an event using the removeEventListener method.
• The default behavior of elements can be prevented using the preventDe-
• Event propagation is the order that the events fire on each element.
• Event delegation is when an event listener is added to a parent element to capture
events that happen to its children elements.
In the next chapter, we'll look at one of the biggest users of events: forms.
Search WWH ::