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 is my first post on Stack Overflow and I'm just wondering on the
This is my first post on Stack Overflow. I am trying to build a
Ahoy Stack Overflow! This be mai first post... I'm attempting to identify users with
This is my first post here and I wanted to get some input from
Well, this is my first post here and really enjoying the site. I have
This is my first time attempting to call an ASP.NET page method from jQuery.
first post here on stack overflow, hoping to get some advice on how to
This is my first post and I'm quite a novice on C++ and compiling
this is my first question to stackoverflow so here it goes... I use cruise
this is my first question here so I hope I can articulate it well

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.