html insert child at specific index code example Example: javascript appendchild at index parentElement.insertBefore(newElement, parentElement.children[2]);