← Back to DOM domain
DOM.copyTo
Creates a deep copy of the specified node and places it into the target container before the
given anchor.
Domain: DOM
experimental
Parameters
| Name | Type | Description |
nodeId | NodeId | Id of the node to copy. |
targetNodeId | NodeId | Id of the element to drop the copy into. |
insertBeforeNodeId (optional) | NodeId | Drop the copy before this node (if absent, the copy becomes the last child of
`targetNodeId`). |
Returns
| Name | Type | Description |
nodeId | NodeId | Id of the node clone. |
Example Request
{
"id": 1,
"method": "DOM.copyTo",
"params": {
"nodeId": 1,
"targetNodeId": "targetNodeId-value"
}
}
Example Response
{
"id": 1,
"result": {
"nodeId": 3
}
}
Usage in Node.js
const result = await send('DOM.copyTo', {"nodeId": 1, "targetNodeId": "targetNodeId-value"});
console.log(result);
// {"nodeId": 3}