How can I copy an element with Javascript?

Hi lovely Hype folks,

Question is pretty simple. I have an element (square) with inner SVG code. How can I use Javascript to copy this element?

Many thanks,

Stephen

Look at the cloneNode() method.

2 Likes

As @DBear suggests cloning is what you want. There are example on the site. search for clone
There are some caveats in doing a clone which are mentioned in some of the threads. i.e You cannot clone the animation of a element and you must remove the HYPE_element class names from the cloned elements

2 Likes

Many thanks guys :wink: Will dig into it today.