# attr

The `attr` option of an extract field.

Reads an attribute instead of the text: an attribute name such as `href`, `@html` for the inner HTML or `@outer` for the outer HTML. Defaults to the normalized text content.

Type: `string`

## Example

```json
{
  "url": {
    "selector": "a",
    "attr": "href",
    "type": "url",
    "base_url": "https://shop.example.com"
  }
}
```

From the contract fixture `product-page-list-regex-json`, a program the test suite validates.
