Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript and the DOM (Retiring) The Browser Environment Thinking Globally

Colin Warn
Colin Warn
6,358 Points

Uncaught TypeError: Cannot read property 'style' of null

Typed in: document.getElementById('myHeading').style.color = 'purple' when he did, got this error.

2 Answers

Close down the browser that has the console open and the work-space then re-fresh the tutorial page.

I had the same issue and did this and now it works.

:)

Steven Parker
Steven Parker
231,236 Points

He doesn't get an error in the video.

I assume your talking about the point at around 4:35 in the video, it seems to work when he does it.

Or did you mean to say you did it, and you got that error? That error would normally mean that no element with the ID "myHeading" was found in the document. Are you sure you had the same document he was using loaded in your browser when you opened the devtools?