Michael Geary schrieb:
>> From: Adam Skinner
>>
>> I'm trying to reference an element from within an iframe.
>>
>> The following normal javascript code works:
>>
>> var iframeDoc = window.frames[iframeName].document;
>> var data = iframeDoc.getElementById(iframeElement);
>>
>> I'm trying to jqueryize the "data" variable as follows (using
>> the actual element id name for the time being):
>>
>> var d2 = $("#inside_iframe_element",iframeDoc);
>>
>> This just yields [], however. How do I refer to an element
>> within the iframe?
>
> Take a look at the code that handles the # selector in jQuery and you will
> see why this doesn't work:
>
> if ( m[1] == "#" ) {
> // Ummm, should make this work in all XML docs
> var oid = document.getElementById(m[2]);
> r = ret = oid ? [oid] : [];
> t = t.replace( re2, "" );
> } else {
>
> It's using a hard coded document.getElementById() instead of using the
> document you provide.
Couldn't that be solved by using:
var oid = self.document.getElementById(m[2]);
Not tested, not sure...
-- Klaus
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/