onclick 子函数,避免父函数

发布于 2024-09-18 09:50:11 字数 151 浏览 3 评论 0原文

我有一个 div 并且它有一个点击事件。在 div 中,有两个链接可用于单独的点击事件。

我的问题是,当我单击两个单独的链接时,div 事件仅触发而不触发链接事件。我如何分别使用这三个事件?

有人帮忙吗?

I have a div and it has a click event. In the div there is two link are available with separate click event.

My problem is, while I click the two separate links, the div event only firing not the link event. How can I use this all three events separately?

Anyone help?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

念﹏祤嫣 2024-09-25 09:50:11

google cancelBubble 和 cancelPropogation (执行相同操作的不同方法,但 firefox 和 ie 需要)

另请参阅:

防止单击超链接时触发父容器单击事件

两个 div 上有两个不同的 OnClick,一个在另一个之上

google cancelBubble and cancelPropogation (different methods that do the same thing but needed for firefox and ie)

also see:

Prevent parent container click event from firing when hyperlink clicked

Two differents OnClick on two divs, one over the other

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文