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

235
Views
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
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!