var downloadButton = document.getElementById("download");
var counter = 16;
var newElement = document.createElement("p");
newElement.innerHTML = "16 Sec";
var id;
downloadButton.parentNode.replaceChild(newElement, downloadButton);
function startDownload() {
this.style.display = 'none';
id = setInterval(function () {
counter--;
if (counter < 0) {
newElement.parentNode.replaceChild(downloadButton, newElement);
clearInterval(id);
} else {
newElement.innerHTML = +counter.toString() + " Second Wait Please";
}
}, 1500);
};
var clickbtn = document.getElementById("btn");
clickbtn.onclick = startDownload;
Post a Comment