Favorites

HTML aria-errormessage ARIA Attribute

aria-errormessage
ARIA AttributeThis ARIA attribute is supported by all modern browsers.
Updated 28th November 2026

The aria-errormessage attribute links a form field to the element that holds its error message, which is shown when the field's value is invalid.

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee

Description

The aria-errormessage attribute points to the element that contains the error message for a form field. It is only used while the field also has aria-invalid="true": when the value is valid, the message should not be exposed.

Show the error message element and set aria-invalid="true" when validation fails, then hide the message and remove aria-invalid when the problem is fixed. To make sure the error is announced as soon as it appears, the message can also be a live region, for example with role="alert".

Screen reader support for aria-errormessage has been patchy, so many developers also reference the message with aria-describedby, which is supported everywhere. Using both is safe.

Properties

Type
Relationship
Value
ID reference list
Default
None
Used with
application, checkbox, combobox, gridcell, listbox, radiogroup, slider, spinbutton, textbox, tree

Syntax

<element aria-invalid="true" aria-errormessage="id">

Values

  • ID reference listThe id of the element that holds the error message.

Example

<label for="email">Email</label>
<input id="email" type="email" aria-errormessage="email-err" aria-describedby="email-err"
onblur="var bad=!this.checkValidity()||!this.value;this.setAttribute('aria-invalid',bad);document.getElementById('email-err').hidden=!bad;">
<p id="email-err" role="alert" hidden style="color:#b91c1c">Enter a valid email address, like name@example.com.</p>

Browser Support

The following information will show you the current browser support for the aria-errormessage ARIA attribute. Hover over a browser icon to see the version that first introduced support for this ARIA attribute.

This ARIA attribute is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee