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 Object-Oriented JavaScript (2015) Practice Project User Interface Code

John Bastian Bolhano
John Bastian Bolhano
4,800 Points

Cannot set property 'innerHTML' of null

I tried to copy what's in the video but my code doesn't work.

https://w.trhou.se/7c6efvu6dx

It outputs an error like this

quiz_ui.js:31 Uncaught TypeError: Cannot set property 'innerHTML' of null
    at Object.populateIdWidthHTML (quiz_ui.js:31)
    at Object.displayProgress (quiz_ui.js:42)
    at Object.displayNext (quiz_ui.js:11)
    at app.js:18

quiz_ui.js:31 Uncaught TypeError: Cannot set property 'innerHTML' of null
    at Object.populateIdWidthHTML (quiz_ui.js:31)
    at Object.displayProgress (quiz_ui.js:42)
    at Object.displayNext (quiz_ui.js:11)
    at HTMLButtonElement.button.onclick (quiz_ui.js:37)

3 Answers

Natalie Cluer
Natalie Cluer
18,898 Points

Hi! when you call the function, you misspelled the id. you have "progess" instead of "progress".

John Bastian Bolhano
John Bastian Bolhano
4,800 Points

Thank you for the help. How did you find the error?

Natalie Cluer
Natalie Cluer
18,898 Points

A lot of the time when there is an error setting the property it is because you are trying to set something that the JS program cannot find. The first place I usually look is where the function is called and follow the trail from there.

John Bastian Bolhano
John Bastian Bolhano
4,800 Points

Thank you for the suggestion. I saw another problem and did follow what you have suggested and it works. Thanks again!

Natalie Cluer
Natalie Cluer
18,898 Points

no problem! Happy coding!:)