Hi James,

When running code inside of an iframe it has it's own window object. So
you'll need to do something like this:

<div id="foo"><iframe></iframe></div>

// Code on iframes page
$('#foo', window.parent).hide();

-js



On 2/9/07, James Thomas <[EMAIL PROTECTED]> wrote:


I have a quandary. I open an iframe with some arbitrary content in it. I
want
to be able to click on something within the iframe to cause the iframe
(and
the div tag that contains the iframe) to go away. I am having trouble
getting to the iframe. I know it's possible as I've seen it elsewhere, I
just can't find the proper path to it.

I basically have this structure:

<html>
       <body>
               <div>
                       <iframe>
                               <html>
                                       <body>
                                               <any tag>
                                       </body>
                               </html>
                       </iframe>
               </div>
       </body>
</html>

It's not exactly accurate but it gives a good idea what I'm looking to do

I've tried:

// This should as far as I can get to the div tag which is where I want to
be
$('#any tag').parents('html').parent().parent();

But when I alert the length of this, I get 0. I've also tried a pure DOM
way
any_tag.ownerDocument.parent.parent.parent
but again, I get nothing.

Firebug tells me I should get something as it displays my whole hierarchy,
which is as follows:
input.#img < div < td < tr < tbody < table < div.rdgrey < form#Form1 <
body
< html < iframe < div < body < html
and when I alert
$('input#img').parents('html').length
I get one so I know it's getting this far.

Any thoughts?

Thanks,

James




--
View this message in context:
http://www.nabble.com/Finding-parent-iframe--tf3201657.html#a8889892
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to