Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4622622
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:52:10+00:00 2026-05-22T02:52:10+00:00

This is my first post to stack overflow,… :) I like this site a

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:52:11+00:00Added an answer on May 22, 2026 at 2:52 am

    I had two problems with my JavaScript.

    1. I was using window.parent.document instead of
      window.opener.document
    2. For some reason the .append() syntax would not allow me to append
      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:

    CopyToThisPageFromTheParent('#accordion', '#testDiv');
    
    function CopyToThisPageFromTheParent(openingWindowSelector, childWindowSelector) {
         var clone = $(openingWindowSelector, window.opener.document).clone(true);
         var theOuterHtml = clone.wrap('<div></div>').parent().html();
         $(childWindowSelector).append(theOuterHtml);
    }
    

    This is assuming I have this HTML:

    <div id="testDiv"></div> 
    

    on my popup window’s page, and this HTML:

    <div id="accordion">something</div> 
    

    in my main page, and used “window.open();” to open up the popup window.

    Thanks,
    David

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is an continuation on another StackOverflow post where no clear answer is
This is my first post on stackoverflow.com so please be kind (rewind) ;) I
This is my first post to stackoverflow so if I've done anything wrong I
This is my first post on StackOverflow, so please bear with me. And I
It has been a long question, so here is the summary first, I have
filtered=[] text=any.pdf if doc and pdf and xls and jpg not in text: filtered.append(text)
I have a static library that is used in production code and test code.
Consider the following code : #wrapper { width: 500px; border: 1px solid black; }
I have a container div (#columnsOne) set up at 920px + 38px padding +

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.