Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-17-2005, 04:29 PM   PM User | #1
MissKay
New Coder

 
Join Date: Jan 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
MissKay is an unknown quantity at this point
Moving DOM nodes

Hi all,

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?

Thanks
MissKay is offline   Reply With Quote
Old 01-17-2005, 06:45 PM   PM User | #2
jkd
Senior Coder

 
jkd's Avatar
 
Join Date: May 2002
Location: metro DC
Posts: 3,163
Thanks: 1
Thanked 18 Times in 18 Posts
jkd will become famous soon enough
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.
__________________
jasonkarldavis.com
jkd is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:57 AM.


Advertisement
Log in to turn off these ads.