← Back to DOM domain

DOM.setAttributeValue

Sets attribute for an element with given id.

Domain: DOM stable

Parameters

NameTypeDescription
nodeIdNodeIdId of the element to set attribute for.
namestringAttribute name.
valuestringAttribute value.

Example Request

{
  "id": 1,
  "method": "DOM.setAttributeValue",
  "params": {
    "nodeId": 1,
    "name": "example-name",
    "value": "example-value"
  }
}

Example Response

{
  "id": 1,
  "result": {}
}

Usage in Node.js

const result = await send('DOM.setAttributeValue', {"nodeId": 1, "name": "example-name", "value": "example-value"});
console.log(result);