0
How do I get this script to work with class="button" instead of id="download"?
codigo js
var downloadButton = document.getElementById("download");
var counter = 10;
var newElement = document.createElement("p");
newElement.innerHTML = "You can download the file in 10 seconds.";
var id;
downloadButton.parentNode.replaceChild(newElement, downloadButton);
id = setInterval(function() {
counter--;
if(counter < 0) {
newElement.parentNode.replaceChild(downloadButton, newElement);
clearInterval(id);
} else {
newElement.innerHTML = "You can download the file in " +
counter.toString() + " seconds.";
}
}, 1000);
Man, thank you so much, I had already put the Document.getElementsByClassName but I didn’t put the [0], so it didn’t work, now it’s working well, vlw :D
– Luckshare22