JavaScript Element ariaErrorMessageElements Property
Beginner
5 min read
Updated: Nov 2026
3 examples
Property
Definition
Element.ariaErrorMessageElements is an array of elements that provide an error message for the element it is applied to (MDN). It is the element-reference form of aria-errormessage.
Read the notes below before you get or set this property. Prefer feature detection when support is limited.
Syntax
Use el.ariaErrorMessageElements. Start with this line.
JavaScript
const nodes = email.ariaErrorMessageElements;
Call
What it does
const nodes = email.ariaErrorMessageElements;
Primary signature.
Built into the browser. Read or assign el.ariaErrorMessageElements — no import required.
Library declarations
JavaScript
const nodes = email.ariaErrorMessageElements;
Parameters
Parameter
Description
Property
Required. el.ariaErrorMessageElements
Attribute
Optional. aria-errormessage id list
Return Value
Return Value
Description
*
The current value of el.ariaErrorMessageElements.
JavaScript Examples
Example 1 — Read from aria-errormessage (MDN)
Resolve the attribute into elements, then join their text.
JavaScript
const email = document.querySelector("#email");
console.log(
"aria-errormessage:",
email.getAttribute("aria-errormessage")
);
if ("ariaErrorMessageElements" in Element.prototype) {
const nodes = email.ariaErrorMessageElements;
const text = nodes.map((el) => el.textContent.trim()).join(" ");
console.log("Error message:", text);
} else {
console.log("ariaErrorMessageElements not supported");
}
Assign an array. No id required when setting the property (MDN).
Expect a cleared attribute. Setting the property clears aria-errormessage.
Still set ariaInvalid when you want the error announced/shown.
Compatibility
Browser Support
Element.ariaErrorMessageElements is Baseline Newly available (MDN: across latest browsers since April 2025). Feature-detect on older engines and keep an aria-errormessage id fallback if needed.
✓ Baseline 2025 · Newly available
ariaErrorMessageElements
Element-reference form of aria-errormessage for form validation errors.
2025Newly available
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
ariaErrorMessageElementsLatest browsers
Bottom line: Prefer the property when supported. Pair with ariaInvalid. Setting the property clears the attribute.
Frequently Asked Questions
An array of HTMLElement subclasses that provide an error message for the element. You can join their text with spaces to form the error message string (MDN).
No. MDN marks Element.ariaErrorMessageElements as Baseline 2025 Newly available (since April 2025). It is not Deprecated, Experimental, or Non-standard. Feature-detect on older browsers.
The attribute uses space-separated id strings. The property uses Element references. Assigned elements do not need an id. Setting the property clears the corresponding attribute (MDN).
Point to the error message with ariaErrorMessageElements (or aria-errormessage), then set ariaInvalid to true when the field is invalid so assistive technologies know the control is invalid (MDN pattern).
No. When read, the returned array is static and read-only. When written, the assigned array is copied — later changes to that array do not update the property (MDN).
Yes. Custom elements can use ElementInternals.ariaErrorMessageElements for the same relationship from inside a component (MDN).