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
Asked
Active
Viewed 28 times
1 Answers
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

William Lafond
- 43
- 4
-
Thanks for the help. Thank you for the recommendation, I'm stuck on the project to do list and trying to program it – Sven Apr 10 '22 at 15:28
-
If you could hit the up arrow to mark this awnser as useful i'd appreciate. – William Lafond Apr 10 '22 at 19:09