jQuery select element in parent window
Solution 1:
Use the context-parameter
$("#testdiv",parent.document)
But if you really use a popup, you need to access opener instead of parent
$("#testdiv",opener.document)
Solution 2:
I looked for a solution to this problem, and came across the present page. I implemented the above solution:
$("#testdiv",opener.document) //doesn't work
But it doesn't work. Maybe it did work in previous jQuery versions, but it doesn't seem to work now.
I found this working solution on another stackoverflow page: how to access parent window object using jquery?
From which I got this working solution:
window.opener.$("#testdiv") //This works.