本文介绍了父窗口中的jQuery选择元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法使用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)但如果你真的使用弹窗,你需要访问 opener 而不是 parent
But if you really use a popup, you need to access opener instead of parent
$("#testdiv",opener.document)更多推荐
父窗口中的jQuery选择元素
发布评论