Reputation: 115
I have a page of distinct links. I'm trying to create a JavaScript counter that counts how many times each individual link has been clicked.
I can count general clicks on any <a href>
element. How can I count clicks on each individual link?
So,
- Bookmark #1 - Cracked.com - Clicked 3 times
- Bookmark #2 - Collegehumor.com - Clicked 1 times
- etc...
var clickcounts = '0';
function count() {
clickcounts++;
alert(clickcounts);
}
<a href="javascript:count();">count clicks</a>
Upvotes: 0
Views: 387