## Function(targetNode, treeNode, moveType, isSilent)zTreeObj.copyNode

### Overview[ depends on jquery.ztree.exedit js ]

Copy the node

When copy nodes, zTree v3.x will clone nodes. If you need to get the data object in zTree, please get the return value of this method.

Please use zTree object to executing the method.

### Function Parameter Descriptions

#### targetNode JSON

JSON data object of the node which will be target.

If copy the node to root node, please set the 'targetNode' to null.

Please ensure that this data object is an internal node data object in zTree.

#### treeNode JSON

JSON data object of the node which will be copied.

Please ensure that this data object is an internal node data object in zTree.

#### moveType String

Copied to the target node's relative position.

"inner" means: to be taregetNode's child node.

"prev" means: to be taregetNode's previous sibling node.

"next" means: to be taregetNode's next sibling node.

#### isSilent Boolean

After copy the node, whether to automatically expand its parent node.

isSilent = true means: don't expand its parent node.

isSilent = false or omit this parameter means: expand its parent node.

#### Return JSON

return the new node in zTree

Note: the node data JSON object in the return value is not equal to the treeNode.

### Examples of function

#### 1. Copy the second root node to the first root node's child node.

    var treeObj = $.fn.zTree.getZTreeObj("tree");
    var nodes = treeObj.getNodes();
    treeObj.copyNode(nodes[0], nodes[1], "inner");

#### 2. Copy the second root node to the first root node's previous sibling node.

    var treeObj = $.fn.zTree.getZTreeObj("tree");
    var nodes = treeObj.getNodes();
    treeObj.copyNode(nodes[0], nodes[1], "before");