Top 10 Custom JavaScript Functions Of All Time
By Dustin Diaz2006-08-22
5) insertAfter()
As far as I know, Jeremy Keith sort of came up with this idea even though one would have thought this too would be a DOM core method. But just like getElementsByClass, it isn’t. So rather than pulling the function straight out of the book, I’ll leave that up to you to buy it yourself. Instead I’ve pulled this simple method from public domain:
insertAfter() on public domain
function insertAfter(parent, node, referenceNode) {
parent.insertBefore(node, referenceNode.nextSibling);
}
Tutorial Pages:
» Top 10 custom JavaScript functions of all time
» 10) addEvent()
» 9) addLoadEvent()
» 8) getElementsByClass()
» 7) cssQuery()
» 6) toggle()
» 5) insertAfter()
» 4) inArray()
» 3, 2, & 1) getCookie(), setCookie(), deleteCookie()
» Last but not least, a bonus function: The Prototype Dollar Function
» And so will they all…
