I am making a tic tac toe game and I want to ensure that a single square can only be clicked once, I have found a way to do this by using null modifiers but this means that if a move is undone the null remains and that square becomes unplayable. I want a way to prevent a square from being played more than once but would become playble again if the undo button were used
Currently to prevent a square from being played more than once I’m using:
onclick="myFunction(); this.onclick=null;"
this does solve my initial problem of preventing more than one move per square but it means that when a move is undone that square remains unplayable as the onclick remains null
.