父窗口中的jQuery select元素 [英] jQuery select element in parent window
本文介绍了父窗口中的jQuery select元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使用jQuery在父窗口中选择DIV?
Is there a way to select a DIV in the parent window using jQuery?
例如:
主页包含此内容,
<div id="testdiv"></div>
弹出页面具有一个带有一些选项和一个应用"按钮的表格.当用户单击应用"时,它将影响主页上的样式属性.
Popup page has a form with some options and an 'Apply' button. When the user clicks apply it affects the style attribute on the main page.
符合逻辑的东西
parent.$("#testdiv").attr("style", content from form);
推荐答案
使用上下文参数
$("#testdiv",parent.document)
但是,如果您确实使用弹出窗口,则需要访问打开器,而不是父级
But if you really use a popup, you need to access opener instead of parent
$("#testdiv",opener.document)
这篇关于父窗口中的jQuery select元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文