如何在同一个html内停止href



我想停止href到同一页面上的div,我尝试过,但不适用于同一页面,但适用于其他页面。

<a href="#tab2" data-toggle="tab" aria-expanded="false"  class="surveydata">

这是我的功能

$("a.surveydata").click(function(event) {
event.preventDefault();
});

但总是使用id tab2 转到我的div

当页面加载时,您可以尝试从标记中删除href属性,如下所示:

$('a.surveydata').first().removeAttr('href');

试试这个:

$("a").click(function(e){
e.preventDefault();
})

最新更新