You are here:

Javascript/Copy a whole DOM node (browser independent)


Rick James wrote at 2009-12-12 01:48:12
It's because you're using the number of CHILD nodes. that's just a guess but maybe. Try starting with the fromNode's parentNode, and then copy all of ITS children nodes.

Rick James wrote at 2009-12-12 01:51:17
Correction, that would work only if the node you're replacing is the ONLY child node if its own parent node. otherwise you'd have to do an extra check which might add extra problems. But if it's the only child node of its own parent, then it could be much more efficient.

dnuske wrote at 2012-10-30 02:04:33
netscape? does the internet existed then? this post is quite old.


All Answers

Ask Experts


Randy L. Taylor


I can answer advanced questions concerning most aspects of web programming including HTML, DHTML, DOM, JavaScript, Cookies, Internet Explorer, and CSSs. I can answer basic questions concerning XML and ActiveX. I can also answer questions concerning Regular Expressions, logical design algorithms, and Object Oriented Programming.


Past/Present clients
Upp Business Systems, LLC
Headquarters Standard Systems Group, USAF

©2017 All rights reserved.

[an error occurred while processing this directive]