如何使用jQuery访问iframe的内容? [英] How to access the content of an iframe with jQuery?

查看:154
本文介绍了如何使用jQuery访问iframe的内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用jQuery访问iframe的内容?我尝试过这样做,但它不起作用:

How can I access the content of an iframe with jQuery? I tried doing this, but it wouldn't work:

iframe内容: < div id =myContent >< / div>

jQuery: $(#myiframe )。find(#myContent)

如何访问 myContent


类似于 jquery/javascript:访问iframe的内容,但接受的答案不是我想要的。

Similar to jquery/javascript: accessing contents of an iframe but the accepted answer is not what I was looking for.


推荐答案

你必须使用内容()方法:

$("#myiframe").contents().find("#myContent")

资料来源: http://simple.procoding.net/2008/03/21/how-to-access-iframe-in-jquery/

这篇关于如何使用jQuery访问iframe的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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