Skip to main content

Events: Bubbling, Capturing and Delegation

Learn Events: Bubbling, Capturing and Delegation (Phase 7 · DOM Manipulation and Events (Essential for browser development), JavaScript) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Reacting to the user • Attach a handler with element.addEventListener("click", handler) ; remove it with removeEventListener using the same function reference. • The handler receives an event object : event.target (what was clicked), event.currentTarget (where the listener is), event.preventDefault() (stop the default action, e.g. form submit or link navigation). • Common events: click , input , change , submit , keydown , focus , mouseover , DOMContentLoaded .

More lessons in Phase 7 · DOM Manipulation and Events (Essential for browser development)