计算锚标签的点击次数 [英] Counting clicks on anchor tag

查看:24
本文介绍了计算锚标签的点击次数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 <a href="" ></a> 在我网站上的一个页面上.我想计算用户点击此链接的次数并显示它.这怎么办?

I have a <a href="" > </a> on a page on my webiste. I wanted to count the number of clicks on this link by the user and display it. How can this be done?

推荐答案

为文档中的每个标签表示一个计数器并使用 jquery.data 存储数据的最佳方式,在每次点击时增加计数器,

best way to represent a counter for each a tag on your document and store the data with jquery.data, increasing the counter on each click,

此处显示的示例:http://jsfiddle.net/ShlomiKomemi/dvdPd/13/

这篇关于计算锚标签的点击次数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆