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.
我的父页面使用 Jquery。
我正在将 iframe 加载到调用另一个页面的父页面上。iframe 页面位于同一域中。
iframe 页面本身没有与之关联的 jQuery。
但我想在这个 iframe 页面内的按钮上使用 jQuery 的 click 方法。
如何从父页面 .js 文件执行此操作?...没有将 jQuery 源文件附加到 iframe 页面?
尝试使用该方法.contents(),然后.find()到达您的元素,如下所示:
.contents()
.find()
$('iframe').contents().find('#yourbutton').click(function(){ //Do whatever you need });
当然,您必须将选择器更改为更具体
在我的网站上,我有一个<我想删除的标志,它显示在桌子之前和 YouTube 视频之后。
<
问题是,该字符没有出现在index.html文件中。为了确定,我已经在三个编辑器中检查过它。我不知道它是从哪里来的。
index.html
如果您在 Firefox 中删除该表,它会消失