-1

I'm new here on Stackoverflow, started programming in January, small own applications could already be implemented and now I have a problem with JavaScript with the removeChild method, because I don't know how to use this method with other methods and functions can combine or must write. Thanks in advance

Sven
  • 1

1 Answers1

0

Not really sure what you are trying to do, your question should be a bit more specific.

Just as an example, say you want to remove all items from a list, here's an example of what could be used.

var element = document.getElementById("top");
while (element.firstChild) {
  element.removeChild(element.firstChild);
}

If you simply want to delete one child you would need to know the parent's Id, it is done like so...

var d = document.getElementById("top");
var d_nested = document.getElementById("nested");
var throwawayNode = d.removeChild(d_nested);

you can try the W3School documentation if you'd like

https://www.w3schools.com/jsref/met_node_removechild.asp