e.preventdefault()方法阻止元素发生默认的行为(例如,当点击提交按钮时阻止对表单的提交)。

语法:
event
.preventDefault()

参数:
event 必需 规定阻止哪个事件的默认动作。这个 event 参数来自事件绑定函数。

例:
a上面的url将不被打开
$("a").click(function(event){
  event.preventDefault();
});
posted @ 2018-10-18 15:55  博客家园-晨  阅读(780)  评论(0编辑  收藏  举报