WitzCode
← All tracks
⚡ JavaScript·DOM & Events

DOM & Events

React to clicks, typing, and more.

DOM

const btn = document.querySelector('button');
btn.addEventListener('click', () => alert('Hi!'));
Challenge 1 / 20 XP

Which finds the first matching element?

Practical task

Add a click listener to the element with id `b`.