html中如何阻止a标签href默认跳转事件

方法一:

<a href="####"></a>

方法二:

<a href="javascript:void(0)"></a>

方法三:

<a href="javascript:void(null)"></a>

方法四:

<a href="#" onclick="return false"></a>

方法五:

$('.stop').click(function(event){ 
   event.preventDefault(); //取消默认的行为
     event.stopPropagation(); //阻止时间冒泡
});

    未经允许不得转载:任鹏个人博客 » html中如何阻止a标签href默认跳转事件

    赞 (1) 打赏

    评论 0

    取消
    • 昵称 (必填)
    • 邮箱 (必填)
    • 网址

    觉得文章有用就打赏一下文章作者

    支付宝扫一扫打赏

    微信扫一扫打赏