Skip to content

Instantly share code, notes, and snippets.

@beizhang
Created December 31, 2011 01:35
Show Gist options
  • Save beizhang/1542390 to your computer and use it in GitHub Desktop.
Save beizhang/1542390 to your computer and use it in GitHub Desktop.
removeNode for IE7
d = d || document.createElement('div');
var id = n.id;
do {
do {
d.appendChild(n);
d.innerHTML = '';
} while (n.parentNode);
} while (n = document.getElementById(id));
@subtleGradient
Copy link

To be safe you should set the ID to something unique just in case there were somehow multiple elements with the same ID or other weird issues.

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