So I'm trying to make a tic-tac-toe game on HTML/JS, however my onclicks just kind of stopped working, the error I get now is that all the functions are not defined. I tried changing my clear() function to jQuery but I am unable to test it.
Essentially, It's getting this html
<td class="tile" id="pos1" onclick="draw(this); checkWinner();"></td>
To recognize this javascript function
var counter = 0;
function draw(elmt){
if(elmt.innerHTML == "x" || elmt.innerHTML == "o")
{
//do nothing
}
else{
if(counter==0){
elmt.innerHTML = "x";
counter = 1;
}
else{
elmt.innerHTML = "o";
counter = 0;
}
}
}
Thank you!