gpt4 book ai didi

javascript - 向 iFrame 中的项目添加事件监听器?

转载 作者:数据小太阳 更新时间:2023-10-29 06:03:49 25 4
gpt4 key购买 nike

给定一个带有 <span class="fineme"> 的 iframe整个 iframe...

是否可以使用 jQuery 添加事件监听器,以便在用户将鼠标移到 .fineme 上时随时触发警报在 iframe 中,从顶部/父窗口?

最佳答案

参见 http://api.jquery.com/contents/用于访问 iframe 的内容文档。

您的问题的解决方案可能是:

$("iframe#name").contents().find(".fineme").bind("mouseover", function() { alert("Found me"); });

关于javascript - 向 iFrame 中的项目添加事件监听器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3273789/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com