Please, I'm getting 'Uncaught TypeError: Cannot set property 'innerHTML' of null' in my web codes. How do I debug this? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Please, I'm getting 'Uncaught TypeError: Cannot set property 'innerHTML' of null' in my web codes. How do I debug this?

Javascript and html error

15th Jun 2019, 9:01 AM
NuminousC
NuminousC - avatar
4 Answers
+ 1
Do : function main() { //all the stuff } window.onload = main ;
15th Jun 2019, 9:04 AM
Théophile
Théophile - avatar
+ 3
but you should post your code here so people can look at it to help find the error
15th Jun 2019, 9:35 AM
Anton Böhler
Anton Böhler - avatar
+ 3
Thanks Theophile, it worked.
15th Jun 2019, 9:50 AM
NuminousC
NuminousC - avatar
+ 2
you should make sure the "document.getElementById("")" or what function your using has the right id.
15th Jun 2019, 9:35 AM
Anton Böhler
Anton Böhler - avatar