Client side validation with the Pattern Attribute
Ankit Beniwal

Ankit Beniwal @ankitbeniwal

About: Love to jump in at the deep end.

Location:
India
Joined:
Oct 13, 2019

Client side validation with the Pattern Attribute

Publish Date: Jan 11 '20
7 0

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

Comments 0 total

    Add comment