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 trialDavid Dickerson
13,845 PointsCannot set property 'innerHTML' of null
I keep getting this error message in Dev tools in Google Chrome: Uncaught TypeError: Cannot set property 'innerHTML' of null I've looked over my code and I can't find a problem!
Here's a snapshot of my code... https://w.trhou.se/4566eakx5x
1 Answer
Daniel Jenkins
17,714 PointsHi David, it looks to me as though you have too many options for the question answers for your html. You define three options for each question but the html only defines two 'p' elements for your choices, so when your loop gets to 'choice2' it fails as there is no element with id 'choice2'. The getElementById call is returning 'null' because it can't find anything with the given id.
Hope that helps.