View Full Version : Duplicate a Div

12-11-2010, 04:29 AM
Okay, Let's Say I have a Div and a Dock/Table.
How would i make the div duplicate into a dock?
Pretty Much how would I duplicate things? and in a specific spot too by class name?

12-11-2010, 06:57 AM
You haven't given much information. I can tell you that the way to duplicate something is to obtain a reference to it and then clone it, ex:


If you want to put the clone somewhere, you need to append it to something else that you have a reference to, ex:


If you just want to move it, then don't clone it:


Appending an existing node moves it. One node cannot be in two places at once.

If you want to use class instead of id, it can get a little complicated depending upon how backward compatible you want it to be.

At that point I would suggest using jQuery. The code can be more succinct and backward compatibility is assured (for the most part).

If you want more help though, I would need to get a clearer idea what you're going for. So if you do want more help:

Please post a link to a page on your site that contains the problematic code so we can check it out.