取消href中的功能 [英] Cancel functionality in a href
本文介绍了取消href中的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个类似的链接
<a href="www.site.com" class="cancel">go there </a>
然后我有一些jQuery:
And then I have some jQuery:
$(".cancel").click(function(){
confirm("sure??");
});
但是当我在警告框中点击取消时,它仍会转到www.site.com而不是什么也不做。如何解决这个问题?
But when I click cancel in the alert box it still goes to www.site.com in stead of doing nothing. How to solve this?
推荐答案
添加退货声明:
$(".cancel").click(function(){
return confirm("sure??");
});
这篇关于取消href中的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文