jquery007-事件绑定的先后顺序

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>顺序</title>
</head>
<body style="width: 980px;margin: 0 auto">
<h1>绑定事件先执行,a标签的默认的后执行。</h1>
<h1>如果要让a标签的默认的不执行。return false即可。</h1>
<h1 >例子</h1>
<a onclick="return go()" href="https://baidu.com">出发1</a>
<a id="i1" href="https://baidu.com">出发2</a>
<script src="jquery3.6.1.js"></script>
<script>
function go(){
alert(123);
return true;
// return false;
}
$('#i1').click(function (){
alert(666);
return false;
});
</script>
</body>
</html>
posted @ 2022-11-27 11:30  wode-wode  阅读(34)  评论(0)    收藏  举报