0

I have two JS calls in a popup that update the state of frame elements in a parent window, that I would like to replace with jQuery calls:

parent.window.opener.parent.frames[0].someCustomFunction(); parent.window.opener.parent.frames[1].document.getElementById('text').value = "some text";

What is the best way to access the these in a parent?

Thx

goe
  • 343
  • 1
  • 4
  • 13
  • possible duplicate of [Pass jquery variables between iframe and parent](http://stackoverflow.com/questions/4689145/pass-jquery-variables-between-iframe-and-parent) – Casey Dwayne Feb 13 '14 at 19:06
  • I need to be able to access frames in the parent rather then an Iframe. Also how do I call the someCustomFunction() function in the first frame from the popup? – goe Feb 13 '14 at 19:13

1 Answers1

0

No need for jQuery, just give a name to frame elements, then you can use the name to refer the window object of a frame. For example in your case:

window.opener.frame_name.someCustomFunction();

When you've the name attribute set, you can also refer a frame from another frame using top property of the window object, for example:

var doc = top.frame_name.document;
Teemu
  • 22,918
  • 7
  • 53
  • 106