【发布时间】:2021-07-26 22:20:12
【问题描述】:
问题: 我正在使用名为“listtree”的轻量级包构建嵌套树,但每当我将链接放入列表中的父元素时都会遇到错误。
错误单击链接时,会触发单击事件以展开树(因为链接包含在需要此事件侦听器的 div 中)并中断链接重定向的流程。
问题如何在单击具有 click EventListener 的父级中的链接时禁止触发此事件触发器。
https://codepen.io/atopbio/pen/zYwROwV/
<div class="listree-submenu-heading">Settings<a href="https://www.google.com"> A link not working</a></div>
【问题讨论】:
标签: javascript html events dom-events