Element.ariaInvalid reflects the aria-invalid attribute: whether the entered value does not conform to the format expected by the application (MDN). Useful on textbox, combobox, checkbox, and similar roles.
Read the notes below before you get or set this property. Prefer feature detection when support is limited.
Syntax
Use el.ariaInvalid. Start with this line.
JavaScript
el.ariaInvalid;
Call
What it does
el.ariaInvalid;
Primary signature.
Built into the browser. Read or assign el.ariaInvalid — no import required.
Assign "spelling". More specific than bare "true".
Reflects to aria-invalid. Property and attribute stay in sync.
Clear with "false" (or remove the attribute) when fixed.
Compatibility
Browser Support
Element.ariaInvalid is Baseline Widely available (MDN: since October 2023). Safe for modern evergreen browsers.
✓ Baseline · Widely available
ariaInvalid
Reflects aria-invalid for form and widget validation state.
99%Widely 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
ariaInvalidExcellent
Bottom line: Use listed tokens. Pair with an error message. Clear to false when the value is valid.
Frequently Asked Questions
It reflects the aria-invalid attribute as a string, telling the accessibility API whether the entered value does not conform to the format expected by the application (MDN).
No. MDN marks Element.ariaInvalid as Baseline Widely available (since October 2023). It is not Deprecated, Experimental, or Non-standard.
The strings "true", "false" (default), "grammar", or "spelling" (MDN). Prefer grammar or spelling when those are the specific error kinds.
If aria-invalid is not present or is set to the empty string, assistive technology treats the value as false. The property itself often returns null when the attribute is omitted (MDN).
When a field is invalid, point to helpful error text with aria-errormessage / ariaErrorMessageElements so users hear why it failed.
Yes. Custom elements can use ElementInternals.ariaInvalid for the same reflected value from inside a component (MDN).