I’ve a few divs with empty span in them and these are meant to start counter that would count up to specified number. I grabbed some code (I’m not very good with JS) from the web and made it work for the first div but I don’t know how to loop(?) over their remaining divs.
let counts = setInterval(updated, 100);
let upto = 0;
function updated() {
let count = document.getElementById("counter-1");
count.innerHTML = ++upto;
if (upto === 100) {
clearInterval(counts);
}
}
.various__item--skill-quantity {
color: black;
transition: all 0.5s;
margin: 0 5%;
}
<div class="various__item--skills-quantity" id="counter-1"><span></span></div>
<div class="various__item--skills-quantity" id="counter-2"><span></span></div>
<div class="various__item--skills-quantity" id="counter-3"><span></span></div>
<div class="various__item--skills-quantity" id="counter-14"><span></span></div>