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