HTML5 introduced a new validation concept called constraint validation.
Constraint validation in HTML is based on:
|
Attribute |
Description |
|
disabled |
Indicates that the input element should be disabled. |
|
max |
Defines the maximum value for an input element. |
|
min |
Sets the minimum value for an input element. |
|
pattern |
Defines the value pattern for an input element. |
|
required |
Indicates that the input field is required. |
|
type |
Defines the type of an input element. |
|
Selector |
Description |
|
:disabled |
Selects input elements that have the “disabled” attribute. |
|
:invalid |
Selects input elements that contain invalid values. |
|
:optional |
Selects input elements that do not have the “required” attribute. |
|
:required |
Selects input elements that have the “required” attribute. |
|
:valid |
Selects input elements that contain valid values. |