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

  • SEARCH
  • Home
  • 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 6563743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:53:06+00:00 2026-05-25T13:53:06+00:00

In this bellow program if you click on ‘PRINT’, the html content of will

  • 0

In this bellow program if you click on ‘PRINT’, the html content of will be added to new popup window called b.html. It is working fine, but b.html has some html content and i am losing this data when new popup window opened. Without missing html content of b.html how can i append new html content inside .

My Sample Code:

Page Name: a.html

                <html>
                     <head>
                          <script type="text/javascript" src="js/jquery-1.6.1.min.js">  </script>
                          <script type="text/javascript">
                               $(document).ready(function()
                               {
                                    $("#print").click(function()
                                    {
                                         var newWind=window.open('b.html', 'Print message',"left=100,screenX=200,menubar=yes, width=980,height=500, location=yes,resizable=yes,scrollbars=yes,status=yes");
                                         var printableHTML=$("#msg").html();
                                         newWind.document.write(printableHTML);
                                         //newWind.append(printableHTML);
                                    });
                               });
                          </script>
                     </head>
                     <body>
                          <span id="print"><u>PRINT</u></span>

                          <div id="msg">
                             <h4>  I am printing this message...</h4>
                          </div>
                     </body>
                </html>

Page Name: b.html

           <html>
                <head> </head>
                <body>
                    <h4>Hello</h4>
                    <div id="target"></div>
                </body>
           </html>
  • 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-25T13:53:07+00:00Added an answer on May 25, 2026 at 1:53 pm

    By using document.write after the page has loaded, you are replacing the document.

    Use load event of the window, so that you can access the content of the document once it has loaded:

    $(newWind).load(function() {
      $('#target', newWind.document).html(printableHTML);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In this below program i am printing the contents of the div when i
This is with reference to the below question: Execute program from within a C
I'm doing a homework project that requires this: Below you will find the code
I am very new to jQuery and javascript programming. I have a program below
OK, This is a method from my program that keeps giving the EXC_BAD_ACCESS error
I keep getting this error when making the program as given below: using System;
This is actually two questions: The first relates to my program The second is
I could use a little help. I got this program to work right then
I have this code below. The thing is, each time I click on the
I have an android program with 3 tabs. When I click on the Map

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.