Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

move dom element to another parent

const newParent = document.getElementById('new-parent');
const oldParent = document.getElementById('old-parent');

while (oldParent.childNodes.length > 0) {
    newParent.appendChild(oldParent.childNodes[0]);
}
 
PREVIOUS NEXT
Tagged: #move #dom #element #parent
ADD COMMENT
Topic
Name
1+9 =