How to append a childnode to a specific position

You can use .insertBefore():

parentElement.insertBefore(newElement, parentElement.children[2]);

Leave a Comment