JavaScript JavaScript and the DOM Getting a Handle on the DOM Select a Page Element By Its ID

Can't find the error in my code.

When I click the button the header does not change color.

I'm getting this error: Uncaught TypeError: Cannot read property 'addEventListener' of null

Here is my workspace:

1 Answer

Armin Kadic
Armin Kadic
13,229 Points

You wrote 'my button' instead of "myButton" in the second line. You also wrote "stlye" instead of "style" in the event listener.