• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can we remove a Node from a DOM tree?

 
Andy Smith
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can we remove a Node from a DOM tree?
I know that one of the way is:-
lNode.getParentNode().removeChild(lNode);

In this method i need to check both lNode and lNode.getParentNode() not null before executing this method??
As if this method is called then refernce of ParentNode becomes null as it is detached from the parent node. Again calling the same method on that node can throw the nullpointerexception
Any other method which don't need the Parent Node reference
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic