Try the following:
$("div#foo").click
(
function()
{
var copyHTML = $("table.bar").html();
var newWindow = window.open('');
newWindow.document.body.innerHTML = copyHTML;
}
);
This will work in some cases, and is the easier than the next approach.
If you get security warnings from your browser, the next approach may be more agreeable. Add a function within the parent page called getContent, like so:
function getContent()
{
return $("table.bar").html();
}
...and on document.ready in the child window do the following:
$(document).ready
(
function()
{
var parentContent = window.opener.getContent();
$("body").html(parentContent);
}
);