This is my first post to stack overflow,… 🙂 I like this site a lot!
My question: How do I copy an element from an opening page into a popup window using JQuery?
Here’s what I have tried so far:
CopyToThisPageFromTheParent('#accordianResults');
function CopyToThisPageFromTheParent(querySelector) {
var clone = $(querySelector, window.parent.document).clone();
$('#testHtml').append(clone);
alert($('#testHtml').html());
}
I’ve also tried:
var clone = $('#accordianResults', window.parent.document).clone();
alert($('#testHtml').html());
Thanks!
David
I had two problems with my JavaScript.
window.opener.document
the cloned object
Instead I had to use the .html() item hanging off of the JQuery selector to pass HTML out of the clone and into .append().
Here is the eventual end result:
This is assuming I have this HTML:
on my popup window’s page, and this HTML:
in my main page, and used “
window.open();” to open up the popup window.Thanks,
David