Below is my simple tic tac toe game. I have a problem in single player mode an error shown up as unable to set innerHTML of null | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Below is my simple tic tac toe game. I have a problem in single player mode an error shown up as unable to set innerHTML of null

help me to solve this... https://code.sololearn.com/WfYNbiU1lRdz/?ref=app

13th Mar 2019, 5:55 PM
viknesh vikky
viknesh vikky - avatar
2 Answers
+ 5
Just put your entire JS code inside a function which will be called once the HTML window is loaded 'cause your JS code cannot find some elements so make sure every element is there in the page and hence is visible be js. And further, for that to work, you must add eventListeners on buttons inside the JS part rather than the HTML part. window.onload= function () { //your entire JS code }
13th Mar 2019, 6:13 PM
Шащи Ранжан
Шащи Ранжан - avatar
+ 4
Thanks it worked
17th May 2019, 4:06 AM
viknesh vikky
viknesh vikky - avatar