0
Click counter
Can someone tell me how to do a click counter?
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