How to access the parent page elements of an Iframe. e.g. If i have a page index.htm and another page in an IFrame in index.htm and want to access the elements of index.htm from that IFrame.
+1
A:
javascript:
parent.document.getElementById('myElement');
jquery:
$('#myElement', window.parent.document);
chrissr
2010-02-23 04:54:29
A:
See my reply to a similar question here:
http://stackoverflow.com/questions/2304076/move-input-text-from-iframe-to-main-window/2304138#2304138
basically, parent gives you the "window" object of the parent window. You can then access window.document to get document... and therefore, you can get window.document.getElementById() by using parent.document.getElementById(id);
ItzWarty
2010-02-23 05:34:50