How to move all HTML element children to another parent using JavaScript?
Basically, you want to loop through each direct descendent of the old-parent node, and move it to the new parent. Any children of a direct descendent will get moved with it. External link