Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的父文档上有几个框架。从框架内 AI 想要检测对 id="frameB" 的框架 B 的点击。
我想我需要先访问父文档。我可以通过以下方式检测到对父文档的点击:
$(parent.document).click(function(){});
但我不知道如何特别获得frameB。
怎么样的东西
$(parent.document).find('#frameB').contents().find('body').on('click', function() { // do stuff });
如果你想让一个文本框做一些驻留在 FrameA 中的事情,为什么不直接将 FrameB 对象绑定到 click 事件,然后在 framA 中的元素上触发事件“click”