简体   繁体   中英

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!

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 ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM