---
title: HTMLTableElement.caption
slug: Web/API/HTMLTableElement/caption
tags:
  - API
  - HTML DOM
  - Property
  - Reference
browser-compat: api.HTMLTableElement.caption
---
{{APIRef("HTML DOM")}}

The **`HTMLTableElement.caption`** property represents the
table caption. If no caption element is associated with the table, this property is
`null`.

## Syntax

```js
var string = tableElement.caption;
```

## Example

```js
if (table.caption) {
  // Do something with the caption
}
```

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- The interface implementing this property: {{domxref("HTMLTableElement")}}.
