+ 3

How can I do a progress bar that decreases every 2 minutes?

Please

8th Sep 2020, 9:27 PM
Carmen LucĂ­a
Carmen LucĂ­a - avatar
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>
8th Sep 2020, 10:57 PM
Abhay
Abhay - avatar
+ 4
Thank You!
8th Sep 2020, 11:26 PM
Carmen LucĂ­a
Carmen LucĂ­a - avatar