I am new to JavaScript and I just copy a code for Download Button Counter. Now I want to change the text color of the counter. Could anybody help me?
Code
var downloadButton = document.getElementById("download");
var counter = 30;
var newElement = document.createElement("p");
newElement.innerHTML = "Job Advertisement will be visible after 30 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);
<div>
<button id="download">Download</button>
</div>
element.style = "color: whatever"