1<!-- beforebegin -->
2<p>
3 <!-- afterbegin -->
4 foo
5 <!-- beforeend -->
6</p>
7<!-- afterend -->
8
9var tempDiv = document.createElement('div');
10paragraph.insertAdjacentElement('afterend', tempDiv);
11
12// inserted div after end of paragraph tag
13<p>
14 foo
15</p>
16<div></div>