题解 | #阻止冒泡事件#
阻止冒泡事件
https://www.nowcoder.com/practice/1c12ccea98b049078d2cd3ef39269856
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<ul>
<li>nowcoder</li>
</ul>
</body>
<script type="text/javascript">
// 补全代码
let item = document.querySelector("li");
item.addEventListener("onclick", (e) => {
e.stopPropagation();
});
</script>
</html>
查看7道真题和解析