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
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
Share Improve this question asked Mar 26, 2009 at 16:25 LorenzoLorenzo 4,64811 gold badges47 silver badges54 bronze badges3 Answers
Reset to default 12You want window.opener
not window.parent
(that's for frames).
You can use context to accessed it:
<script type="text/javascript">
$(document).ready(function(){
var content = $("#summary",window.opener.document).html();
});
</script>
If you opened the window with window.open(...), check out window.opener