Returns an exact copy of the current node.
The new node contains the same attributes with the same values as the original element. The child elements of the cloned node can also be copied in the original order with the cloneNode method (depending on the first parameter of the cloneNode method). The new node has no parent, use the insertBefore or appendChild method to insert it into the document.
If you need to copy a node from another document into the current document, use the importNode method.
You can find the related objects in the Supported by objects section below.
Required in Firefox and Opera, optional in Internet Explorer, Google Chrome and Safari. Boolean that indicates whether the child element need also be duplicated.
One of the following values:
Returns the newly created node.
Example HTML code 1:
This example illustrates the use of the cloneNode method:
Did you find this example helpful?
User Contributed Comments