DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Javascript - Dom Method For Removing Nodes

09.15.2006
| 22506 views |
  • submit to reddit
        You can remove existing nodes as well as add new ones. 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 elements within the node being removed will be removed along with it.

<script type="text/javascript">

function removeBElm(){

    var para = document.getElementById("example2");

    var boldElm = document.getElementById("example2B");

    var removed = para.removeChild(boldElm);

}
</script>

<p id="example2"><a href="#" onclick="removeBElm(); return false;">Click this link</a> to see the above script in action.</p>
    

Comments

Nitin Khare replied on Sun, 2013/03/24 - 12:10pm

what is digital transcription

 I have found very useful information over there, thanks for sharing this. please try to add more informative posts in order to keep us in touch.

Nitin Khare replied on Sun, 2013/03/17 - 12:30am

writing research proposal
the morning too before the sun got too hot. They did as we ask without too much complaining. Now they know all the different vegetables in the garden by sight. Good job kids.

 

Alicia Expart replied on Wed, 2012/11/07 - 8:07am

write my essay for cheap

I always like your blog post because you always comes with different ideas and information. I always shared your site post with my friends. Keep posting and i will follow you..

Rao Yasir replied on Sun, 2012/10/14 - 3:30am

Thanks for the nice blog. It was very useful for me. Keep sharing such ideas in the future as well. This was actually what I was looking for, and I am glad to came here! Thanks for sharing the such information with us. statistics homework solver

Backlink Expart replied on Thu, 2012/09/20 - 6:27pm

This is definitely useful information if you want to keep your contacts update and organized. Thank you! essay papers

Snippets Manager replied on Mon, 2012/04/02 - 11:37pm

The java scrips become easier when you have learn C++ language and than it becomes easier.Manual Link building service