HTML Form Validation is heavily underused
01-Nov-2024 101
Beyond that, there is a bunch of other ways that you can add constraints to your input. Precisely, there are three ways to do it:
Using specific type attribute values, such as "email", "number", or "url"
Using other input attributes that create constraints, such as "pattern" or "maxlength"
Using the setCustomValidity DOM method of the input
The last one is the most powerful as it allows to create arbitrary validation logic and handle complex cases. Do you notice how it differs from the first two techniques? The first two are defined with attributes, but setCustomValidity is a method.
HTML Form Validation is heavily underused #js #javascript #Validation #heavily #underused https://www.javascript.ba/link/html-form-validation-is-heavily-underused