---
title: NamedNodeMap.getNamedItem()
slug: Web/API/NamedNodeMap/getNamedItem
tags:
  - DOM
  - Method
  - NamedNodeMap
  - Reference
browser-compat: api.NamedNodeMap.getNamedItem
---
{{APIRef("DOM")}}

The **`getNamedItem()`** method of the
{{domxref("NamedNodeMap")}} interface returns the {{domxref("Attr")}} corresponding to
the given name, or null if there is no corresponding attribute.

## Syntax

```js
myAttr = attrs.getNamedItem(name)
```

### Parameters

- `name` is the name of the desired attribute

## Browser compatibility

{{Compat}}
