Javascript examples for DOM:Element removeChild
Remove all the DOM elements with a specific tag name in Javascript
<html> <head></head> <body> <div> one// ww w . j av a2 s. c o m </div> <div> two <div> three </div> </div> <div> four </div> <script> Array.prototype.slice.call(document.getElementsByTagName('div')).forEach(function(item) { item.parentNode.removeChild(item); } ); </script> </body> </html>