The pattern attribute is used to specify the regular expression on which the input element value is checked.
The pattern attribute works with the following input types: text, password, date, search, email, etc.
If u want that password field only required 6 alphabet no numeric values are acceptable.
ex: <input type="text" pattern="[A-Za-z]{6}" >
If u want that password field only required 8 alphabet and 1 numeric value is required.
ex: <input type="text" pattern="[A-Za-z]{7}-[0-9]{1}" >
Example:
The pattern attribute works with the following input types: text, password, date, search, email, etc.
If u want that password field only required 6 alphabet no numeric values are acceptable.
ex: <input type="text" pattern="[A-Za-z]{6}" >
If u want that password field only required 8 alphabet and 1 numeric value is required.
ex: <input type="text" pattern="[A-Za-z]{7}-[0-9]{1}" >
Example:
If u entered the wrong pattern it shows an alert.
0 Comments