Events in JavaScript
Events in JavaScript: Responding to Clicks with addEventListener, The Event Object, Bubbling and Event Delegation, Keyboard Users and Accessible Controls.
Updated
- Responding to Clicks with addEventListener (Apprentice): An event is something that happens on the page, such as a click, and addEventListener tells the browser which of your functions to run each time it happens.
- The Event Object (Apprentice): Every listener is handed an event object that says what just happened, so one function can tell which button was clicked, which element it landed on, and which key was pressed.
- Bubbling and Event Delegation (Journeyman): A click travels up from the element it happened on through every parent, so one listener on a list can handle every button inside it, even buttons added later.
- Keyboard Users and Accessible Controls (Journeyman): Build controls that work for people who use a keyboard or a screen reader, with real buttons, aria-pressed and aria-expanded that match what the page shows, and an Escape key that closes what's open and puts focus back.