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

237
Vistas
Can we make timer in alert using javascript?

I want to make an alert that has a timer in it, the alert will show this message:

Please wait to process data 3 second..

Please wait to process data 2 second..

Please wait to process data 1 second..

and if the timer is done, the text will change to:

Succesfully process data..

I tried this one:

function countdown() {
    var seconds = 3;
    function tick() {
        var counter = document.getElementById("counter");
        seconds--;
        counter.innerHTML = "Please wait to process data " + String(seconds)+ " Second";
        if( seconds > 0 ) {
            setTimeout(tick, 1000);
        } else {
            alert("Succesfully process data");
        }
    }
    tick();
}

countdown();

<div id="results"></div>
<button id="stop">Stop</button>

but this code will show the timer in div, not in alert. I tried to edit to make it show in alert but still can not figure it out.

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