Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var myDemoObject = {
element: document.querySelector('#toRemove'),
child: {
element: document.querySelector('#toRetain')
}
};
// Removing DOM sub-tree after some user interactions
myDemoObject.element.parentNode.removeChild(myDemoObject.element);
// Clearing the reference to this DOM, it's not required anymore
myDemoObject.element = null;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment