Hello I have iframe and in the iframe i need to get element of the parent window. How can i do it ?
index.html
child.html get parent element by id
asked May 7, 2016 at 13:17
usmauriga
931 gold badge1 silver badge5 bronze badges
-
Possible duplicate of Getting parents document from iFrame and stackoverflow.com/questions/7027799/…Turnip– Turnip2016年05月07日 13:19:38 +00:00Commented May 7, 2016 at 13:19
1 Answer 1
If you have var myVar in the parent window, you can access it from the child window with window.parent.myVar.
Note: this will only work if both child and parent are on the same domain.
See here for more info.
answered May 7, 2016 at 13:22
I wrestled a bear once.
23.5k20 gold badges74 silver badges122 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
default