0
点赞
收藏
分享

微信扫一扫

JQUERY 阻止a 标签链接

<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- 引入jQuery -->
<script src= type="text/javascript"></script>
<script>
$(function(){
$("a").click(function(event) {
alert(event.type);//获取事件类型
return false;//阻止链接跳转
});
})
</script>
</head>
<body>
<a href='http://google.com'>click me .</a>
</body>
</html>

作者:沐雪 文章均系作者原创或翻译,如有错误不妥之处,欢迎各位批评指正。本文版权归作者所有,如需转载恳请注明。 如果您觉得阅读这篇博客让你有所收获
​​​ 为之网-热爱软件编程 http://www.weizhi.cc/​​



举报

相关推荐

0 条评论