Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

158
Vistas
How to re-use animation each time element.textContent is changed?

this is pretty simple, but I have javascript generating textContent changes for a rock paper scissors project. The fade in animation only works on the first event.

I've tried searching the web for solutions. I tried element.removeChild(element.firstChild); right before each textContent change, but it didn't work I think because the textContent is not considered a node. I tried deleting the textContent right before each change, which also didn't work. Any help is much appreciated!

Javascript snippet:

 if ((playerPick === "Rock" && computerPick === "Scissors") || (playerPick 
        === "Paper" && computerPick === "Rock") || (playerPick === "Scissors" && 
        computerPick === "Paper")) {
            playerWins++;
            rounds++;
            round.textContent = `You win! ${playerPick} beats ${computerPick}!`;
        }

CSS snippet:

.narrative-banner {
        text-align: center;
        color: white;
        font-size: 2.2em;
        font-weight: 700;
        padding: .2em;
        padding-top: .8em;
        animation: fade-in 5s;
}
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda