如何使用javascript或jquery获取框架中的元素? [英] How to get the element in a frame using javascript or jquery?
本文介绍了如何使用javascript或jquery获取框架中的元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有一个页面存在sevreal帧,我怎样才能获得页面的一些元素?
我尝试了什么:
我试图使用find(),但是它是字段,
for $(#frame1)。children()。长度,我得到了值0,
为什么?
There is one page that exists sevreal frames, how can i get some element for the page ?
What I have tried:
I have tried to use find(), but it field,
for $("#frame1").children().length, I got the value 0,
why ?
推荐答案
(#frame1)。children()。长度,我得到了值0,
为什么?
("#frame1").children().length, I got the value 0,
why ?
你应该使用 .contents( ) [ ^ ]在iframe中查找元素
You should use .contents()[^] to find an element inside iframe
(' #iframeID'跨度>)的内容()长度。; // 1
('#iframeID').contents().length; // 1
查找元素
to find an element
这篇关于如何使用javascript或jquery获取框架中的元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文