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

314
Vistas
How could I remove the ::after effect using JS?

I want to remove the ::after effect after a function is completed using JS.

Here is the code:

let text = 'Stack Overflow is a question and answer website for professional and enthusiast programmers. It is the flagship site of the Stack Exchange Network,[4][5][6] created in 2008 by Jeff Atwood and Joel Spolsky'
let interval;
let i = 0;
interval = setInterval(function() {
  if (i < text.length) {
    document.querySelector('div').textContent += text.charAt(i)
  } else {
    window.clearInterval(interval)
  }
  i++
}, 20)
div::after {
  content: '|'
}
<div></div>

I just wonder if there is a way that I could remove the "|" (::after effect) after the interval finished.

Thanks for any responds!

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

If you add a class to your definition, you can switch this one and off

div.foo::after{ content:'|' }

setInterval(function(){
                if(i<text.length){
                document.querySelector('div').textContent += text.charAt(i)
            }
            else{
                window.clearInterval(interval)
                document.querySelector('div').classList.remove("foo");
            }
            i++
            },20)
about 4 years ago · Santiago Trujillo Denunciar
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