insertAdjacentElement() demo

Click colored box to select it, then use the first two buttons below to insert elements before and after your selection.