Event Handling Overview | Unobtrusive Event Handling | Event Object | Event Handler Objects | More About Events | Week 8 Worksheet

Before you start learning about event handling, make sure you review your term 1 notes on Progressive Enhancement.

Progressive Enhancement

It’s also important to understand the difference between obtrusive and non-obtrusive JavaScript.

We always code with unobtrusive JS.

The principles of unobtrusive JavaScript

What is Unobtrusive JavaScript & Why it's Important?

What is Event Handling?

Event handling is the process of writing code that executes when a certain event occurs in your application.

We tend to think of events as things the user does, or triggers, such as clicking on an object, dragging an object, moving the mouse over/out of an object’s boundaries, pressing a key while an object has the focus, or submitting a form. These are all events

But there are a few events that aren’t directly triggered by a user, such as the DOM content loading, which are triggered by the browser or other components.

The Modern JavaScript Tutorial Introduction to Events lists a few of the more common events you can easily learn to write handlers for.

Introduction to events - Learn web development | MDN

How Event Handling Works

  1. DOM Nodes are registered with an event handler (also called an event listener).
  1. The programmer writes the event handler / event listener.