Justin Erswell
Justin Erswell

Reputation: 708

JQuery Window.Opener

twoI am trying to write back some values to a parent page and have written the following but it is saying that SCRIPT5007: Unable to get value of the property 'document': object is null or undefined

$('#Save').click(function () {
    var parent = $(parent.document.body);
    $(parent).find('input#addr_address1').val(addone);
    $(parent).find('input#addr_address2').val(addtwo);
    $(parent).find('input#addr_city').val(city);
    $(parent).find('input#addr_county').val(county);
    $(parent).find('input#addr_postcode').val(postcode);
    $(parent).find('input#addr_country').val(country);
    window.close();            
});

Essentially the variables are set in another function and the values need to be sent back to a set of fields on the parent page.

Any help would be awesome!

Upvotes: 2

Views: 3450

Answers (1)

Dan Davies Brackett
Dan Davies Brackett

Reputation: 10061

In the F12 debugger (I assume you're using IE, by the format of the error message), check the values of parent and parent.document. I bet parent is null. did you mean opener? or top?

Upvotes: 1

Related Questions