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.
window.alert()reference page to see no such functionality is exposed.