'removeChild()' Example : removeChild « Javascript Methods « JavaScript Reference

Home
JavaScript Reference
1.Event Handlers Reference
2.Javascript Collections
3.Javascript Methods
4.Javascript Objects
5.Javascript Properties
JavaScript Reference » Javascript Methods » removeChild 
'removeChild()' Example

    
<html>
<body>
<script language="JavaScript">
function function2() {
    var m = "New Element";
    var n = document.createElement("li");
    n.appendChild(document.createTextNode(m));
    document.getElementById("myList").appendChild(n)

function function2() {
    myList.removeChild(myList.lastChild);
}
</script>
<ul id="myList">
   <li>First list element</li>
   <li>Second list element</li>
</ul>
<input type="button" value="Add list item" onClick="function2();">
<input type="button" value="Remove added items" onClick="function2();">
</body>
</html>

    
      
      
Related examples in the same category
1.'removeChild()' Syntax, Parameters and Note
2.'removeChild()' is applied to
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.