Home/Tutorials/JavaScript/Events and Listeners

0 of 2 saved

JavaScript5 min read

Events and Listeners

Read this chapter, then pass a short check to open the next one.

Respond to user actions.

Events and Listeners

addEventListener registers handlers. Prefer listening on parents with delegation for lists. Prevent default on form submit when you handle it in JS.

  • click, input, submit, keydown are common.
  • event.target is the source element.
  • Remove listeners when components unmount (React does this for you).

After you read this chapter, use Write (when available) and Quiz on this page to lock it in.