add sibling element javascript code example
Example 1: select sibling javascript
let nextSibling = currentNode.nextElementSibling;
Example 2: 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>