setting parent node in javascript
问题 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