Javascript examples for DOM:Element removeChild
Element removeChild Method - Remove a <li> element with id="myLI" from its parent element
<!DOCTYPE html> <html> <body> <ul><li>Coffee</li><li id="myLI">Tea</li><li>Milk</li></ul> <button onclick="myFunction()">Test</button> <script> function myFunction() {/*from w w w . j a va 2 s .c om*/ var item = document.getElementById("myLI"); item.parentNode.removeChild(item); } </script> </body> </html>