XML DOM removeChild() Method
Complete Node Object Reference
Definition and Usage
The removeChild() method removes a child node.
This function returns the removed node on success, or NULL on failure.
Syntax
|
elementNode.removeChild(node) |
| Parameter |
Description |
| node |
Required. Specifies the child node to remove |
Example
The following code fragment loads "books.xml"
into xmlDoc using
loadXMLDoc() and removes a child node in the first <book> node:
Example
xmlDoc=loadXMLDoc("books.xml");
y=xmlDoc.getElementsByTagName("book")[0];
x=xmlDoc.documentElement.removeChild(y);
document.write("Removed node: " + x.nodeName);
|
Output:
Try it yourself »
|
Complete Node Object Reference
 |
W3Schools' Online Certification Program
The perfect solution for professionals who need to balance work, family, and career building.
More than 4000 certificates already issued!
|
The HTML Certificate documents your knowledge of HTML, XHTML, and CSS.
The JavaScript Certificate documents your knowledge of JavaScript and HTML DOM.
The XML Certificate documents your knowledge of XML, XML DOM and XSLT.
The ASP Certificate documents your knowledge of ASP, SQL, and ADO.
The PHP Certificate documents your knowledge of PHP and SQL (MySQL).
|