Last Updated: June 23, 2016
·
325
· b-rucel

DOM insertAfter

<div>
    <div id="#referenceNode">REFERENCE NODE</div>
</div>

<script>
function insertAfter( newNode, referenceNode ) {
    referenceNode.parentNode.insertBefore( newNode, referenceNode.nextSibling );
}

insertAfter( '<div>NEW NODE</div>', document.querySelector( '#referenceNode' ) );
</script>