How to access main window element from iframe
I hope someone can help with this problem. I have a popup iframe using lytebox. I would like it so that when a link in my iframe with class "mylink" is clicked, that it makes an ajax call and updates the div in my main window with id "mydiv". I know how to do onclick events and ajax calls, but I don't know how to access "mydiv" from the main window and update it with content. Any help on this would be greatly appreciated. Thanks.
0
markie
a source
to share
1 answer
You can just use window.parent.document
to access the parent document from the iframe.
jQuery allows you to specify the context for your search so that you can:
$(myselector, window.parent.document);
+1
a source to share