TIL the browser's built-in form validation features are surprisingly robust


TIL the browser's built-in form validation features are surprisingly robust.

1. Declare attributes like required, min, max, minLength, maxLength, and pattern (regex) on fields.

2. Call checkValidity() to validate. 😎

More: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation

Here's an excellent tutorial on MDN: https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation

View original on X