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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:52:48+00:00 2026-06-13T05:52:48+00:00

when Im cloning an object in javascript by doing object.cloneNode(true) the parentNode is null

  • 0

when Im cloning an object in javascript by doing object.cloneNode(true) the parentNode is null in the new copy.
Im trying to set it but with no success.
my code look like this:

old_DataRoot = DataRoot.cloneNode(true);
old_DataRoot.parentNode=DataRoot.parentNode.cloneNode(true);

also tried:

    old_DataRoot = DataRoot.cloneNode(true);
    old_DataRoot.parentNode.appendChild(DataRoot.parentNode.cloneNode(true));

both options give me “old_DataRoot.parentNode is null or not an object”
what am I doing wrong?

thanks alot,
Yoni.

  • 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-13T05:52:49+00:00Added an answer on June 13, 2026 at 5:52 am

    If you’re trying

    to make a backup of the original DataRoot in order to recover it
    later.

    then consider

    // Backup
    var DataRootBackup = {
        nodes: DataRoot.cloneNode(true),
        parent: DataRoot.parentNode
    };
    
    // Restore
    DataRootBackup.parent.appendChild( DataRootBackup.nodes );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Anybody know how to do a deep copy/cloning of a native javascript event object?
i tried the following code for cloning the object. while compiling it shows clone
I have a problem cloning dynamic object with the code like this: public void
When (deep) Cloning a custom object, should I use clone.str1 = String.Copy(obj.str1) or clone.str1
I need to callback Javascript function in my code, but not firing. I am
I am trying to automatically clone an object without having to instantiate a new
Possible Duplicate: Java: recommended solution for deep cloning/copying an instance I have an object
There's a lot of hubub about cloning JavaScript objects. However, as I understand it,
Is the window object onclose() or closing() event exposed in HTML/Javascript?
As we know we can instantiate an object without new keyword by using classloader/object

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.