Skip to content
Advertisement

Tag: dom

How can I remove a child node in HTML using JavaScript?

Is there a function like document.getElementById(“FirstDiv”).clear()? Answer To answer the original question – there are various ways to do this, but the following would be the simplest. If you already have a handle to the child node that you want to remove, i.e. you have a JavaScript variable that holds a reference to it: Obviously, if you are not using

Advertisement