JavaScript: Create/Clone Element

By Xah Lee. Date: . Last updated: .
Create a new tagName element. Return it.

[see Create and Insert HTML Element]

Create a new text node with the node value of string str.
Return a copy of node. If includeChildNodes is true, include all child nodes. Default to false.

πŸ›‘ WARNING: the cloned node have the same ID attribute, if the original has an ID. You should change it after cloning.

The content of node as string. You can read or set this value. [see DOM: textContent, innerHTML, innerText, nodeValue]
BUY Ξ£JS JavaScript in Depth

Basic DOM Element Methods