0

How to code a counter in html css

Html css

7th Jun 2020, 7:38 AM
Abdelrahman El Gammal
Abdelrahman El Gammal - avatar
2 Answers
+ 2
From css you can do it like this: https://code.sololearn.com/W6UiPBk24vK0/?ref=app
7th Jun 2020, 10:28 AM
Gabriel Ilie
Gabriel Ilie - avatar
+ 1
You can't as far as I understand You can use js In html <div id="counter"></div> In js window.onload=function(){ document.getElementById("counter").addEventListener("click",function(){ setInterval(counting,10); }); var i=0; function counting(){ document.getElementById("counter").innerHTML=i; i++; } } Now if you click on div element ,counter will start,if this is not what you wanted let me know!
7th Jun 2020, 8:08 AM
Abhay
Abhay - avatar