4 ms·
There's also insertBefore, which you can use to move a node anywhere: parentNode.appendChild(node); // move to top parentNode.inser
by perilunar 8y ago
There's also insertBefore, which you can use to move a node anywhere:
parentNode.appendChild(node); // move to top
parentNode.insertBefore(node, parentNode.firstChild); // move to the bottom
parentNode.insertBefore(node, someNode); // move just below someNode
parentNode.insertBefore(node, someNode.nextSibling); // move just above someNode