Example: Insert an <hr>
after the navigation bar
This presumes that there is an element whose ID is "navbar"
.
var navbar, newElement; navbar = document.getElementById('navbar'); if (navbar) { newElement = document.createElement('hr'); navbar.parentNode.insertBefore(newElement, navbar.nextSibling); }