JavaScript
1
Вклад в тег
newElement.classList.add('Class');
, где Class - имя вашего класса.var downloadButton = document.getElementById("download");
var counter = 10;
var newElement = document.createElement("div");
newElement.innerHTML = "You can download the file in 10 seconds.";
var id;
newElement.classList.add('Class');
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);