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

97
Vistas
Change display of element after while loop

I want to show a loading screen until a while loop completes. Here is some code to briefly illustrate the principle behind my problem. I need to be using a while loop for the logic I have. The while loop's execution time will significantly vary based on user input.

var x = 0;
var y = 100;
document.getElementById("x").style.display = "block";
while (x < y) {
x++;
}
document.getElementById("x").style.display = "none";
console.log("done");

The issue is in updating the DOM after execution. Console logs fine, but the element's style doesn't change so that it disappears.

about 4 years ago · Santiago Gelvez
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