Answers for "Removing DOM nodes when traversing a NodeList"

0

Removing DOM nodes when traversing a NodeList

NodeList nodes = ...;
for (int i = nodes.getLength() - 1; i >= 0; i--) {
  Element e = (Element)nodes.item(i);
   if (certain criteria involving Element e) {
    e.getParentNode().removeChild(e);
  }
}
Posted by: Guest on June-17-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language