← Back to DOM domain
DOM.moveTo
Moves node into the new container, places it before the given anchor.
Domain: DOM
stable
Parameters
| Name | Type | Description |
nodeId | NodeId | Id of the node to move. |
targetNodeId | NodeId | Id of the element to drop the moved node into. |
insertBeforeNodeId (optional) | NodeId | Drop node before this one (if absent, the moved node becomes the last child of
`targetNodeId`). |
Returns
| Name | Type | Description |
nodeId | NodeId | New id of the moved node. |
Example Request
{
"id": 1,
"method": "DOM.moveTo",
"params": {
"nodeId": 1,
"targetNodeId": "targetNodeId-value"
}
}
Example Response
{
"id": 1,
"result": {
"nodeId": 3
}
}
Usage in Node.js
const result = await send('DOM.moveTo', {"nodeId": 1, "targetNodeId": "targetNodeId-value"});
console.log(result);
// {"nodeId": 3}