iframe src is like this:-<iframe src="http://mysite.com/testing.php?id=7632762"></iframe>
and the content is dynamic.How to find out number of <div>
or <li>
or <p>
tags inside a iframe
by using javascript on server side or client side ?
-Thank you
views:
25answers:
2
A:
$("iframe>div").each(function(){counter++;})
Similarly for other elements. It would be easier if you add some id to the iframe.
Satyajit
2010-07-13 19:07:48
Or just $("iframe>div").length
Christoffer
2010-07-13 19:09:38
@Christoffer: that's easier, I admit.
Satyajit
2010-07-13 19:11:04
That will not work. You need to use .contents
redsquare
2010-07-13 19:20:15
+2
A:
On the assumption that the iframe src is on the same domain as the source page and has finished loading its resource then you can use the following:
$("iframe").contents().find("div").length
redsquare
2010-07-13 19:08:54