Hello Devmates, 👋
Today I learned about the client side validation using
The Pattern Attribute
It is used to provide a regular expression (regex) to the input element of HTML. This regex is automatically checked just like a required attribute is checked in HTML.
It works with the input types including text, search, url, tel, email, and password.
Here is a pen demonstrating an email input which only accept secure emails:
Note: Never rely on only client side validation. Server Side validation is important from the security perspective. (I know this is obvious, Don't give me that look 😐)
You may want to connect with me on twitter or checkout my #devdiaries on instagram.
Good night 😴😴 from India
Reference:
https://www.w3schools.com/html/html_form_attributes.asp
Top comments (0)