<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>阻止点击事件冒泡</title>
<style>
.father {
width: 400px;
height: 400px;
border: 1px solid #cccccc;
display: flex;
align-items: center;
justify-content: center;
}
.son {
width: 200px;
height: 200px;
background-color: aquamarine;
}
</style>
</head>
<body>
<div class="father">
<div class="son"></div>
</div>
<script src="jquery.min.js"></script>
<script>
$(".father").click(function(){
console.log("1")
})
$(".son").click(function(){
event.stopPropagation();
console.log("2")
})
</script>
</body>
</html>