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 trialHugo Paigneau
4,253 PointsGot an error when i ue the document.getElementById('myHeading').style.color = 'purple' functon
The consol told me this : TypeError: document.getElementById(...) is null[En savoir plus] scripts.js:1:1 <anonyme>
2 Answers
Steven Parker
231,236 PointsThis error would seem to indicate that there is no element with an ID of "myHeading".
This can happen if the JavaScript code is executed before the page is fully loaded. Is the <script>
tag the very last thing in the body of the HTML?
Charlie Harcourt
8,046 PointsClose 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.
:)
Vic Mercier
3,276 PointsVic Mercier
3,276 PointsCould you give me More information about what you are doing \Pouvez-vous me donner plus d'info