$("a").click(function(e) {
e.preventDefault();//取消事件的默认动作。
if (!$(this).data('isClicked')) {
var link = $(this);
// Your code on successful click
// Set the isClicked value and set a timer to reset in 3s
link.data('isClicked', true);
setTimeout(function() {
link.removeData('isClicked')
}, 3000);
} else {
// do nothing or alert Anything you want to say 'Bad user!' haha
}
});
移动开发中防止链接被多次点击
最新推荐文章于 2024-08-14 06:08:09 发布