Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Moving DOM nodes
01-17-2005, 05:29 PM #1
- Join Date
- Jan 2005
- Thanked 0 Times in 0 Posts
Moving DOM nodes
I've been playing with a page where a number of forms create new paragraphs, tables and divs further down the page, which is now all working fine. What I can't seem to do though is to move a node which I have created to somewhere else in the page. I can delete them and create them, but the node I want to use has quite a number of child nodes so I didn't want to have to recreate them all again. Does anyone know how to move a node without deleting and rewriting it please?
01-17-2005, 07:45 PM #2
If you appendChild(thenode) to some other element, it is first removed from the document then readded.
You could also thenode.cloneNode(true), then append that elsewhere, and delete thenode later on.