JavaScript Events Worksheet

Questions

Question 1

What is an 'event handler'?

It is a function that runs in response to a specific event.

Question 2

How are event handlers invoked?

They're invoked automatically by the browser when their event occurs.

Question 3

What is an 'anonymous' function?

It's a function that has no name. Often used as an inline callback.

Question 4

Explain what the addEventListener() method of a DOM element is, and explain the purpose of each of it's parameters.

It lets you attach an event handler to a DOM element.

Coding Problems

Coding Problems - See the 'script' tag below this h3 tag. You will have to write some JavaScript code in it.

Always test your work! Check the console log to make sure there are no errors.

Orange

Green