How can I tell to the iframe to load() a different content from the main 
document?

--- On Tue, 9/15/09, Paolo Chiodi <chiod...@gmail.com> wrote:

From: Paolo Chiodi <chiod...@gmail.com>
Subject: [jQuery] Re: Very disappointed with jquery and iframe communication
To: jquery-en@googlegroups.com
Date: Tuesday, September 15, 2009, 1:42 PM


Of course it doesn't work.
You are searching for node elements with id=login that are child of
your iframes. You need to use the dom of the page loaded inside the i
frame
try $(frames['Theiframe']).get(0).contentDocument

I in the content page is present jquery, use
$(frames['Theiframe']).get(0).contentWindow.$('#login')

BTW, you can access child dom only if in same domain

Paolo

On Tue, Sep 15, 2009 at 10:53 AM, ximo wallas <igguan...@yahoo.com> wrote:
>
> After 1 day googling and trying I find no agreement in a solid method for 
> comunicating with iframe, this is the nearest point I've been to get in touch 
> with IFRAME:
>
> $(frames['Theiframe']).ready( function ()
> {
>     alert('Frame is loaded');
>
> });
>
> This will alert the message, but any attempt to comunicate with the iframe 
> and access it's contents have been useless, I have a hidden field with with 
> ID "login" and I'm trying to get it's value:
>
> $(frames['Theiframe']).find("#login").val(); //Doesn't work in FF 3.0.14
>
> /////////////////////////////////////////////////////////////////////////////////////////////////////
>
> var $currentIFrame = $(frames['Theiframe']);
> $currentIFrame.contents().find("body #login").val() //Neither does in FF 
> 3.0.14
>
> If you Google a few you will see that everyone is giving it's own opinion on 
> how to do it, but there's no agreement and no crossbrowser solid solution...
>
>



      

Reply via email to