InsertAdjacent is a function that permits:
Demo:
let pSibling = document.createElement('p');
pSibling.innerText = 'A paragraph';
document.body.insertAdjacentElement('afterbegin', pSibling);
let bodySibling = document.createElement('script');
bodySibling.text = 'console.log("Hello World !");';
document.body.insertAdjacentElement('beforeend', bodySibling);
document.body.insertAdjacentHTML('afterend', '<p>Body Sibling HTML</p>');
element.insertAdjacentElement(position, siblingElement);
element.insertAdjacentHTML(position, text);
where position is:
<!-- beforebegin -->
<element>
<!-- afterbegin -->
text
<!-- beforeend -->
</element>
<!-- afterend -->
insertAdjacentHTML is an advanced version of InnerHtml and therefore does not execute any script while insertAdjacentElement will execute them.