cloneNode()
cloneNode(deep)
Parameters
deep
Optional
If true
, then the node and its whole subtree, including text that may be in child Text
nodes, is also copied.
If false
, only the node will be cloned. The subtree, including any text that the node contains, is not cloned.
Note that deep
has no effect on void elements, such as the <img>
and <input>
elements.
The new Node
cloned. The cloned node has no parent and is not part of the document, until it is added to another node that is part of the document, using Node.appendChild()
or a similar method.
let p = document.getElementById("para1");
let p_prime = p.cloneNode(true);
Specifications Browser compatibility
Loadingâ¦
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.5