I recently started working on cloning displayed objects.
I noticed that basically there are two ways to clone nodes:
1) I tried to clone the nodes using the cloneNode method, which is pretty good but not supported in older browsers.
var newNode = oldNode.cloneNode(deep);
cloneNode Reference MDN
2) For older browsers, I try to copy outerHTML and set the value to innerHTML. how
newNode.innerHTML = oldNode.outerHTML
Note:
For some older versions of Internet Explorer, innerHTML is a read-only property for table elements.
What is the best of the above methods or is there any other best method. Please help me.
user3278797
source
share