Table of contents
- 1. Properties
- 2. Specification
The DOM ValidityState interface represents the validity states that an element can be in, with respect to constraint validation.
Properties
| Name | Type | Description |
|---|---|---|
customError | Boolean | The element's custom validity message has been set to a non-empty string by calling the element's setCustomValidity() method. |
patternMismatch | Boolean | The value does not match the specified
pattern
. |
rangeOverflow | Boolean | The value is greater than the specified
max
. |
rangeUnderflow | Boolean | The value is less than the specified
min
. |
stepMismatch | Boolean | The value does not fit the rules determined by
step
. |
tooLong | Boolean | The value exceeds the specified maxlength for HTMLInputElement or HTMLTextAreaElement objects. Note: This will never be true in Gecko, because elements' values are prevented from being longer than maxlength. |
typeMismatch | Boolean | The value is not in the required syntax (when
type
is email or url). |
valid | Boolean | No other constraint validation conditions are true. |
valueMissing | Boolean | The element has a
required
attribute, but no value. |
Mozilla Developer Network