+ 3
How can I do a progress bar that decreases every 2 minutes?
Please
2 Answers
+ 5
Using setInterval
<progress id="progress" max="100" value="100"></progress>
<script>
let progress=document.querySelector("#progress");
let i=100;
let id=setInterval(function(){
i-=20;
if(i>=0){
progress.value=i;
}
else{
clearInterval(id);
}
},120000)
</script>
+ 4
Thank You!