0Pricing
JavaScript Academy · Lesson

Keyboard and Mouse Events

Handle clicks, key presses, and pointer events.

Input Event Families

Mouse and keyboard events let you build rich interactions. Each family has specialized event types and properties.

The click Event

click fires on a primary press-and-release. It also fires for keyboard activation on buttons and links, making it accessible.

btn.addEventListener("click", () => {
  console.log("activated");
});

All lessons in this course

  1. addEventListener Basics
  2. The Event Object
  3. preventDefault and stopPropagation
  4. Keyboard and Mouse Events
← Back to JavaScript Academy