This page is about Sibling manipulation in the DOM
What is InsertAdjacent and InsertAdjacentHTML and how to use them ? can insert at this positions:
<!-- beforebegin -->
<element>
<!-- afterbegin -->
text
<!-- beforeend -->
</element>
<!-- afterend -->
See Sibling selector
<p>First</p>
<p>Second</p>
let p = document.querySelector("p");
console.log(p.nextElementSibling.innerText);