Event Listener Quiz
Multiple Choice Easy
Question
Which method attaches an event handler to an element?
Hint
It has 'add' and 'listener' in its name.
Explanation
addEventListener is the standard method for attaching event handlers. It allows multiple handlers per event and works with all modern browsers. attachEvent was the old IE-specific method. The syntax is: element.addEventListener('click', handler).
Related Resources
Related Lessons
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.