[ACCEPTED]-How to get an element outside of iframe with javascript or jQuery?-iframe

Accepted answer
Score: 24

Same-origin policy:
You might want to check this. Two pages 4 need to have the same origin.

If your child page is located at same domain as parent page, You can write a code like below in the child window :
 $('#test1', parent.document).html('<h1>clicked</h1>');

The second 3 parameter provides the context in which to search 2 the element matched by the first parameter. The 1 Document is here:http://api.jquery.com/jQuery/#jQuery-selector-context

 jQuery( selector [, context ] )

Hope this helps.

More Related questions