How to move an element into another element?
my solution:
MOVE:
jQuery("#NodesToMove").detach().appendTo('#DestinationContainerNode')
COPY:
jQuery("#NodesToMove").appendTo('#DestinationContainerNode')
Note the usage of .detach(). When copying, be careful that you are not duplicating IDs.
What about a JavaScript solution?
// Declare a fragment:var fragment = document.createDocumentFragment();// Append desired element to the fragment:fragment.appendChild(document.getElementById('source'));// Append fragment to desired element:document.getElementById('destination').appendChild(fragment);