XML DOM Clone Nodes![]() ![]() ExamplesIn the examples below, we will use the XML file books.xml, and the JavaScript function loadXMLDoc(). Copy a node and add it to the node list Copy a NodeThe cloneNode() method creates a copy of a specified node. The cloneNode() method has a parameter (true or false). This parameter indicates if the cloned node should include all attributes and child nodes of the original node. The following code fragment copies the first <book> node and then adds the copy to the end of the node list:
Output:
![]() ![]() |
|