Organizational Research By

Surprising Reserch Topic

how to access parent window object using jquery

how to access parent window object using jquery  using -'javascript,jquery'

How to acess parent window object using jquery?

This is my Parent window variable , I want to set its value after closing child window .

$('#serverMsg').html('some text here');


asked Sep 9, 2015 by FawAndronic
0 votes

Related Hot Questions

1 Answer

0 votes

If you are in a po-up and you want to access the opening window, use window.opener. The easiest would be if you could load JQuery in the parent window as well:

window.opener.$("#serverMsg").html // this uses JQuery in the parent window

or you could use plain old document.getElementById to get the element, and then extend it using the jquery in your child window. The following should work (I haven't tested it, though):

element = window.opener.document.getElementById("serverMsg");
element = $(element);

If you are in an iframe or frameset and want to access the parent frame, use window.parent instead of window.opener.

According to the Same Origin Policy, all this works effortlessly only if both the child and the parent window are in the same domain.

answered Sep 9, 2015 by DustinFryett