MicrolearnENPTES

Events: clicks and keys

Lesson 14 of 20 · Web.Micro

Make the page react: listen for clicks, keys and other events and run a function.

button.addEventListener("click", fn) calls fn every time the button is clicked. Click the button in the preview.

Check yourself

Which method makes an element react to clicks?

Do it in the browser: a real HTML, CSS and JavaScript tool, a short mission and instant feedback. No install.

Start this lesson — free
← Changing the pageForms and input →

All lessons · Web.Micro