Javascript examples for DOM:Element removeChild
use element.parentNode.removeChild to remove an element
<html> <head> <script type="text/javascript"> function removeTable(id) {// w w w . j av a2 s.c o m var tbl = document.getElementById(id); if(tbl) tbl.parentNode.removeChild(tbl); } </script> </head> <body> <table id="toc" class="toc" border="1" summary="Contents"> <tbody> <tr> <td>This table is going</td> </tr> </tbody> </table> <input type="button" onclick="removeTable('toc');" value="Remove!"> </body> </html>