在iframe父级访问div [英] access div in iframe parent

查看:113
本文介绍了在iframe父级访问div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个页面,其中包含一个iframe到另一个页面,我在寻找的是点击iframe中的内容,然后可以访问或更具体地隐藏父项中的div。我知道一些JQuery,但由于某种原因,当我试图在自己的代码编辑器中编写代码时,只是呆呆地呆在代码编辑器中。

在iframe中试试这个:

  $('#DIVtobehidden',window.parent.document).hide(); 


I have a page which contains an iframe to another page, what I am looking for is to click something inside the iframe, which can then access or more specifically hide a div in the parent. I know some JQuery but for some reason just sit there blankly at the code editor when I try to write it on my own

解决方案

try this in iframe:

$('#DIVtobehidden', window.parent.document).hide();

这篇关于在iframe父级访问div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆