Skip to content

Instantly share code, notes, and snippets.

@xyqfer
Created September 28, 2013 11:53
Show Gist options
  • Save xyqfer/6741327 to your computer and use it in GitHub Desktop.
Save xyqfer/6741327 to your computer and use it in GitHub Desktop.
insertAfter
function insertAfter(newChild,refChild){
varparElem=refChild.parentNode;
if(parElem.lastChild==refChild){
refChild.appendChild(newChild);
}else{
parElem.insertBefore(newChild,refChild.nextSibling);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment