← Back to DOM domain

DOM.setAttributesAsText

Sets attributes on element with given id. This method is useful when user edits some existing attribute value and types in several attribute name/value pairs.

Domain: DOM stable

Parameters

NameTypeDescription
nodeIdNodeIdId of the element to set attributes for.
textstringText with a number of attributes. Will parse this text using HTML parser.
name (optional)stringAttribute name to replace with new attributes derived from text in case text parsed successfully.

Example Request

{
  "id": 1,
  "method": "DOM.setAttributesAsText",
  "params": {
    "nodeId": 1,
    "text": "text-value"
  }
}

Example Response

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

Usage in Node.js

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