---
title: HTMLImageElement.name
slug: Web/API/HTMLImageElement/name
tags:
  - API
  - Deprecated
  - HTML
  - HTML DOM
  - HTMLImageElement
  - Image
  - Property
  - Reference
  - img
  - name
browser-compat: api.HTMLImageElement.name
---
{{APIRef("HTML DOM")}}{{deprecated_header}}

The {{domxref("HTMLImageElement")}}
interface's *deprecated* **`name`** property specifies
a name for the element. This has been replaced by the {{domxref("Element.id", "id")}}
property available on all elements.

## Syntax

```js
htmlImageElement.name = nameString;
nameString = htmlImageElement.name;
```

### Value

A {{domxref("DOMString")}} providing a name by which the image can be referenced.

> **Warning:** This property is deprecated and is only in the
> specification still for backward compatibility purposes. Since it functions
> identically to {{htmlattrxref("id")}}, you can and should use it instead.

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}
