Reference parent window document

11,766

Solution 1

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

Solution 2

You can use context to accessed it:

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

Related videos on Youtube

Lorenzo
Author by

Lorenzo

Updated on June 04, 2022

Comments

  • Lorenzo
    Lorenzo almost 2 years

    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

Related