I'm learning JavaScript and want to make a game of the old one to train. The game is not working and I think it might be a logic bug.
function verificar(elemento) {
var teste = document.getElementById(elemento).innerHTML;
if (teste == "") {
teste = "X";
} else {
teste = "Y";
}
}
.container {
max-width: 130px;
}
.tab {
float: left;
height: 30px;
width: 30px;
border: solid green 2px;
}
<div class="container">
<div class="tab" id="q1" onlick="verificar(this.id);"></div>
<div class="tab" id="q2" onlick="verificar(this.id);"></div>
<div class="tab" id="q3" onlick="verificar(this.id);"></div>
<div class="tab" id="q4" onlick="verificar(this.id);"></div>
<div class="tab" id="q5" onlick="verificar(this.id);"></div>
<div class="tab" id="q6" onlick="verificar(this.id);"></div>
<div class="tab" id="q7" onlick="verificar(this.id);"></div>
<div class="tab" id="q8" onlick="verificar(this.id);"></div>
<div class="tab" id="q9" onlick="verificar(this.id);"></div>
</div>