ValidityState: valueMissing property
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since December 2018.
The read-only valueMissing
property of a ValidityState
object indicates if a required
control, such as an <input>
, <select>
, or <textarea>
, has an empty value.
If the required
attribute is set, and no <option>
is selected or a <textarea>
or user-editable <input>
is empty, the valueMissing
property will be true
. The property is only true
if the field is required and has no value; if the field is not required, or if the field is required and has a value, the value is false
.
Specifications
Specification |
---|
HTML Standard # dom-validitystate-valuemissing-dev |
Browser compatibility
BCD tables only load in the browser