首页 > Web开发 > 详细

jquery preventDefault()方法 语法

时间:2019-11-30 16:53:45      阅读:84      评论:0      收藏:0      [点我收藏+]

jquery preventDefault()方法 语法

作用:preventDefault() 方法阻止元素发生默认的行为(例如,当点击提交按钮时阻止对表单的提交)。大理石平台价格

语法:event.preventDefault()

参数:

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

jquery preventDefault()方法 示例

<html>
<head>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("a").click(function(event){
    event.preventDefault();
  });
});
</script>
</head>
<body>
<a href="http://www.furuihua.cn/">大理石平台</a>
<p>preventDefault() 方法将防止上面的链接打开 URL。</p>
</body>
</html>

jquery preventDefault()方法 语法

原文:https://www.cnblogs.com/furuihua/p/11962503.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!