Helping ordinary people create extraordinary websites!

Top 10 Custom JavaScript Functions Of All Time

By Dustin Diaz
2006-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:
 4 Votes

You might also want to check these out:


Leave a Comment on "Top 10 Custom JavaScript Functions Of All Time"
You must be logged in to post a comment.

Link to This Tutorial Page!


GET OUR NEWSLETTERS