views:

38

answers:

2

when you append by using an existing content, jquery will delete the orignal:

$(new).append($('#ori'));

then the orignal $('#ori') in the document will be deleted, is this by design?

+1  A: 

Try:

$(new).append($("#ori").clone());

if you want to keep the original.

cletus
A: 

Yes

Adds a node to the end of the list of children of a specified parent node. If the node already exists it is removed from current parent node, then added to new parent node.


If you want to keep the original element, use cletus' code.

Andreas Grech