0

I have a html code like :

<div id="a">
<div id="b">
<iframe id="demo" />

</div>
</div>

How can I refer the iframe element using jquery?

I have tried jQuery("#demo").bind(.), but It doesn't work.

Amber
  • 812
  • 8
  • 21
Sibendu
  • 49
  • 7
  • Does this link answer your question? http://stackoverflow.com/questions/1796619/how-to-access-the-content-of-an-iframe-with-jquery – Adam Lawson Dec 31 '13 at 09:55
  • @Adam : MY question is other way round!! I need to select iframe present within those two div's – Sibendu Dec 31 '13 at 10:00
  • Note: your iframe is within a div within a div, maybe you should try telling jquery where to find it, rather then just what id to find. – Amber Dec 31 '13 at 10:06
  • @amber: according to you,it should be jQuery("#a #b #demo") ?? – Sibendu Dec 31 '13 at 10:08
  • @Sibendu Yes, that should work. You can use the `$` sign instead of `jQuery` to save space if you want. If it doesn't work, you can try glueing some `.find()`s after it – Amber Dec 31 '13 at 10:17
  • Also note that your current `bind(.)` won't do anything as it doesn't contain a function to bind to the iframe. – Amber Dec 31 '13 at 10:22
  • yes bind(.) I have just kept blank.Actually I'm using click event along with that.Hope it works!! – Sibendu Dec 31 '13 at 10:26
  • No it is not working!!.Actually there is another div having id as "a".Iam unsure whether this is causing the problem – Sibendu Dec 31 '13 at 14:43

0 Answers0