views:

1467

answers:

3

Hi there,

I'm trying to access the parent window document from a popup.

<script type='text/javascript'>
    $(document).ready(function(){
     var summary = window.parent.document.getElementById('summary');
     var content = summary.innerHTML;
    });
</script>

Is it even possible? Is there a jQuery specific way to do it?

Thanks

+4  A: 

You want window.opener not window.parent (that's for frames).

Greg
Thanks guys, that did it!
L. De Leo
+1  A: 

If you opened the window with window.open(...), check out window.opener

Phill Sacre
A: 

You can use context to accessed it:

<script type="text/javascript">
    $(document).ready(function(){
        var content = $("#summary",window.opener.document).html();
    });
</script>
aprian