»
EnglishFrenchVietnamese

Print - Removing Nodes Using the DOM - JavaScriptBank.com

Full version: jsB@nk » Snippet » Removing Nodes Using the DOM
URL: http://www.javascriptbank.com/removing-nodes-using-the-dom.html

Removing Nodes Using the DOM © JavaScriptBank.comYou can remove existing nodes using the DOM. The removeChild method allows any node to remove one of its child nodes. Simply pass a reference to the node you wish to remove. Any text or innerHTML elements within the node being removed will be removed along with it.

Full version: jsB@nk » Snippet » Removing Nodes Using the DOM
URL: http://www.javascriptbank.com/removing-nodes-using-the-dom.html



JavaScript
<script type="text/javascript">// Created by: Brad | http://snippets.dzone.com/posts/show/2598function removeBElm(){  var para = document.getElementById("example");  var boldElm = document.getElementById("example2");  var removed = para.removeChild(boldElm);}</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<fieldset style="width: 340px;"><legend>Remove a section</legend><div id="example"><p>Ma quande lingues coalesce, li grammatica del resultant lingue.</p><p id="example2">Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p></div></fieldset><p id="example2"><a href="#" onclick="removeBElm(); return false;">Click this link</a> to remove the section above.</p><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->