Retrieves the value of a specified attribute for the element. Returns null if the attribute does not exist. Example: attribute(name: "href") on an <a> tag, or attribute(name: "data-custom") on any element.

Definition

attribute(
  name: String!
): String

Arguments

name: String!

The name of the attribute to retrieve. Example: "class", "id", "value", "src".

Returns

String

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Usage

This field is available on the Page object. Use it to query page information and content.