0

Click counter

Can someone tell me how to do a click counter?

5th May 2018, 1:10 PM
THATguy18
THATguy18 - avatar
2 odpowiedzi
0
you declare a variable equal to zero: var clicks = 0 you add a button that calls a function: <button onclick=add()>CLICK</button> in the javascript, add a function that adds one value to the variable and displays the number: function add(){ clicks++ document.getElementById(“display”).innerHTML = clicks
24th Apr 2019, 5:19 PM
THATguy18
THATguy18 - avatar