I have this fiddle where when the user clicks a button the counter works: http://jsfiddle.net/z66WF/
This is the code:
<button type="button" onClick="clickME()">Click me</button>
<p>Clicks: <a id="clicks">0</a></p>
var clicks = 0;
function clickME() {
clicks += 1;
document.getElementById("clicks").innerHTML = clicks;
}
The problem is that I want the number to be saved, so for example:
- user #1 clicks on the button 10 times
- user #2 opens the site and the count is at 10, he clicks and now the counter starts 11
- and so on with new users.
I'm trying to do this to keep track of how many times a file has been downloaded.
Any idea how can I do that?
See Question&Answers more detail:os