+ 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
2 Réponses
+ 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
}
+ 4
Thanks it worked