Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

156
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!