DOM Events with JavaScript
Learn to create webpage interactivity by leveraging JavaScript events in the browser.
StartKey Concepts
Review core concepts you need to learn to master this subject
.addEventListener()
.removeEventHandler()
Event handler
Event object
Keyboard events
javascript event
JS Event Handlers
Mouse events
.addEventListener()
.addEventListener()
eventTarget.addEventListener("event", eventHandlerFunction);
The .addEventListener()
method attaches an event handler to a specific event on an event target. The advantage of this is that you can add many events to the event target without overwriting existing events. Two arguments are passed to this method: an event name as a string, and the event handler function. Here is the syntax:
DOM Events with JavaScript
Lesson 1 of 1
What you'll create
Portfolio projects that showcase your new skills
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory