Form Validation Attributes
HTML5 added built-in validation that the browser handles automatically — no JavaScript required.
Validation Attributes
| Attribute | Description |
|---|---|
required | Field must not be empty |
minlength | Minimum number of characters |
maxlength | Maximum number of characters |
min / max | Min/max value for numbers and dates |
pattern | Regex pattern the value must match |
type="email" | Validates email format automatically |
Add novalidate to the form tag to disable browser validation (useful when using JS validation).