简体   繁体   中英

How do I add an option to a select box in a parent window using jquery?

In my child window I have

$('#opfile').addOption("someval",sometext");

Problem is #opfile is an a parent window I cant get it to communicate

I tried

window.opener.$('#opfile').addOption("someval",sometext");

but no luck any ideas?

Update

Embarssing but I got the above to work might have been caching something

Thanks for the suggestions

This may be helpful.

Communication between browser windows

Though this is not directly related to the select box example, but the concepts may be applied here.

I'll watch this space, if anyone has a better solution.

try this by changing array in options

window.opener.document.getElementById("opfile").options[0] = new Option("someval",sometext");

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