Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

drag and drop clone

Status
Not open for further replies.

richardko

Programmer
Jun 20, 2006
127
US
hi,
i am trying to create a drag and drop utility where i want to duplicate the "div" that i am dragging so that when the "div" is dropped the original "div" is still in original location.

i tried clonenode but its not working. Are there any other methods to create exact copy of the item.
thanks
ro
 
cloneNode should work, although you will need to pass "true" as a parameter to clone all child nodes.

The only caveat, AFAIK, is that it does not clone events that have been attached - you might need to do that manually after the clone.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
You would want to use cloneNode, then add it to your page. To use cloneNode by itself will not "paste" that div onto the viewing area, you have to add it with a method like

appendChild

[monkey][snake] <.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top