javascript add adjacent html code example
Example 1: javascript add adjacent html
ul = document.querySelector('ul');
ul.insertAdjacentHTML('afterbegin','<li>Hello</li>');
// <ul>
// <li>Hello</li>
// </ul>
Example 2: javascript add adjacent html
<!-- beforebegin -->
<p>
<!-- afterbegin -->
foo
<!-- beforeend -->
</p>
<!-- afterend -->