Skip to content

Instantly share code, notes, and snippets.

@suhajdab
Created April 29, 2012 12:18
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suhajdab/2550036 to your computer and use it in GitHub Desktop.
Save suhajdab/2550036 to your computer and use it in GitHub Desktop.
prependChild
Node.prototype.prependChild = function(el) {
this.childNodes[1]&&this.insertBefore(el, this.childNodes[1]) || this.appendChild(el);
}​
@chrishazfun
Copy link

Thank you so much for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment