Apologies, I don't have formal training in Javascript. I am trying to make a function that operates a loading progress bar. I'd like to add the "donezo" class to #ammount upon completion. However, the class is not being added. I believe the variables are initialized correctly. Doing a querySelector instead of the "ammount" var does seem to work. Hopefully someone can explain why this is the case to me? Much appreciated.
(function move() {
var ammount = document.getElementById("ammount");
var counter = document.getElementById("counter");
var wrapper = document.getElementById("wrapper");
var status = 1;
var loader = setInterval(fireZeLoader, 10);
function fireZeLoader() {
if (status >= 100) {
clearInterval(loader);
wrapper.innerHTML = wrapper.innerHTML + '<div class="finished">Complete</div>';
ammount.classList.add("donezo");
} else {
status++;
ammount.style.width = status + '%';
counter.innerHTML = status + '%';
}
}
}());