replied on September 4, 2019
This is awesome! Thanks, very helpful. Can someone help me out with the code to take advantage of some CSS classes I've got on a form I'm building using this code? I've tried a few things and can't seem to get it to work. I know the CSS classes I have do work when applied to other elements of the form. I just need to be able to apply the CSS to the portion that says BOOM!. I'm using this as a save now countdown timer. Any help would be highly appreciated!
//Countdown Timer Test
var xMinutes = 0;
var xSeconds = 10;
document.getElementById("cntDown").innerHTML = "Remember to Save your draft in: " + xMinutes + ":" + xSeconds;
var timer = setInterval(function() {
xSeconds--;
if (xSeconds < 10) {
document.getElementById("cntDown").innerHTML = "Remember to Save your draft in: " + xMinutes + ":0" + xSeconds;
} else {
document.getElementById("cntDown").innerHTML = "Remember to Save your draft in: " + xMinutes + ":" + xSeconds;
}
if (xMinutes == 0 && xSeconds == 0) {
clearInterval(timer);
document.getElementById("cntDown").innerHTML = "SAVE NOW";
document.getElementByClassName("cntDown").innerHTML = "doneClass";
document.getElementByClassName("cntDown").innerHTML = "blinkerClass";
}
if (xSeconds == 0) {
xMinutes--;
xSeconds = 59;
}
}, 1000);
//End Countdown Timer Test
Here is my CSS
.done {color: tomato !important; font-weight: bold;}
.blink {
animation: blinker 1.5s step-start infinite;
}
@keyframes blinker {
50% {
opacity: 0;
}
}