js add sibling code example
Example: javascript insert sibling after
<!-- beforebegin -->
<p>
<!-- afterbegin -->
foo
<!-- beforeend -->
</p>
<!-- afterend -->
var tempDiv = document.createElement('div');
paragraph.insertAdjacentElement('afterend', tempDiv);
// inserted div after end of paragraph tag
<p>
foo
</p>
<div></div>