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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:41:32+00:00 2026-06-05T02:41:32+00:00

I’m trying to move child div elements between two different parent divs using jQuery

  • 0

I’m trying to move child div elements between two different parent divs using jQuery .appendTo method but when the code is executed, the page turns blank and all elements have been removed from DOM. All that’s left is pure text inside the tags. This is how the page is layed out (but of course not as simplistic as this example. For the actual site, see the below link):

 <div id="flip-container">
    <div id="flip-card">

      <div class="front face" id="frontPage">
      <div id="start"> text content...</div>
      <div id="about"> text content...</div>
      </div>


      <div class="back face" id="backPage">
      <div id="references"> text content... </div>
      <div id="contact"> text content... </div>
      </div>


    </div>
 </div>

I use jQuery to move the child divs between parent front/back face divs using the appendTo method:

 $("#references").appendTo($("#frontPage"));

This code alone works, this is just to give you an idea of how the actual site is laid out.

When the above code is executed, all divs are literally wiped away, leaving only the body tag and the div content. Hence, I cannot tell whether the div has actually been move correctly or not. This happens in all browsers and I’ve tried several different jQuery methods such as prependTo, append, inserAfter and clone. All with the same result. And yes, the specified divs do exist. Obviously, I’ve googled this frenetically but all I can find is this, which really doesn’t answer the question: JQuery append element removes all html dom elements

So what is wrong here, what have I missed? Any help is greatly appreciated.

To the code in actual and where it fails, visist the below link.
Click on one of the footer icons, then press the same again to see the problem appear.

http://utvecklingpunkten.se/list2LS/iscroll.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-06-05T02:41:34+00:00Added an answer on June 5, 2026 at 2:41 am

    Look at your source code:

    <div id="statisticsDiv" class="innerPages">
      <script> for(i=0;i<50;i++) {document.write("statistics "+i+"<br>"); }</script>
    </div>
    

    You are using document.write to create the content of the elements of your page.

    Now, when you click on the “Statistics” icon (the second time), the DIV is relocated to a different part of the page. This causes the SCRIPT block to execute again. Live example Therefore, document.write will execute. As a result, the page will be destroyed.

    The rule is that when document.write is executed after the page-load event, the page is destroyed and replaced with the new content provided to document.write.

    My recommendation would be to avoid document.write. Instead, generate the content in the DOM-ready event-handler, and use jQuery to find the elements of your page and set their content.

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

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I am reading a book about Javascript and jQuery and using one of the
I am trying to understand how to use SyndicationItem to display feed which is
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.