While checking your inner moves the innerHTML of the div with id ganador
is replaced by Ha ganado el jugador
. SO now what happens is that the span with id errorenTurno
is lost.
Your errorenTurno
span is inside the ganador span.
<p><span id="ganador"><span id="errorenTurno"></span></span>
So either you have to append the message to ganador
or move out the errorenTurno
span out side of ganador
. once the message is displayed there is no longer an element named errorenTurno