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 6979263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:51:51+00:00 2026-05-27T17:51:51+00:00

I have two DIV’s called DIV1 and DIV2 and DIV1 consists of dynamic content

  • 0

I have two DIV’s called DIV1 and DIV2 and DIV1 consists of dynamic content and DIV2 is empty. I need content of DIV1 to be displayed in DIV2. How can I do it.

I coded in below manner which is not working. Anybody please correct it.

<script type="text/javascript">

   var MyDiv1 = Document.getElementById('DIV1');
   var MyDiv2 = Document.getElementById('Div2');
   MyDiv2.innerHTML = MyDiv2; 

</script>
<body>
<div id="DIV1">
 // Some content goes here.
</div>

<div id="DIV2">
</div>
</body>
  • 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-27T17:51:51+00:00Added an answer on May 27, 2026 at 5:51 pm

    (1) Your <script> tag should be placed before the closing </body> tag. Your JavaScript is trying to manipulate HTML elements that haven’t been loaded into the DOM yet.
    (2) Your assignment of HTML content looks jumbled.
    (3) Be consistent with the case in your element ID, i.e. ‘DIV2’ vs ‘Div2’
    (4) User lower case for ‘document’ object (credit: ThatOtherPerson)

    <body>
    <div id="DIV1">
     // Some content goes here.
    </div>
    
    <div id="DIV2">
    </div>
    <script type="text/javascript">
    
       var MyDiv1 = document.getElementById('DIV1');
       var MyDiv2 = document.getElementById('DIV2');
       MyDiv2.innerHTML = MyDiv1.innerHTML;
    
    </script>
    </body>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two div : <div id=div1></div> <div id=div2></div> and i have the following
I have two div containers with content in them and two buttons outside the
I have two div columns sidebar(left) and page-content(right). I toggle removing and adding 'sidebar'
I have two DIV-elements, which are assigned an array called stack using data() .
I have two div element in my page aligned vertically. content of one div
I have a very simple requirement. I have two div. Div1 with a Link
I have two div elements on a page. How can I make one div
I have two div's which when clicked fadeOut content and fadeIn new content. The
I have two div elements that are twins (i.e. their dimensions and contents are
I have two div -elements, the top one has the height of 40% and

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.