HTML — Form Input Validation
HTML provides built-in form validation using attributes like required
, min
, max
, maxlength
, pattern
, and type
.
These validations help ensure correct user input before the form is submitted.
<form>
<label>Email:</label>
<input type=\"email\" required />
<br />
<label>Age:</label>
<input type=\"number\" min=\"18\" max=\"99\" />
<br />
<label>Password:</label>
<input type=\"password\" pattern=\".{6,}\" required />
<br />
<button type=\"submit\">Register</button>
</form>