The pattern value is use in input box which tells the user, In which pattern value will store in database. If the value is according to pattern then data will store otherwise it will shows an error.
Its works with following input types:-
text,search,date, tel,url,password and email.
Example 1-
<input type="text" name="code" pattern="[A-Za-z]{3}" title="Three letter code">
According to upper example, you can add three algebraic letters.
Example 2-
<input type="password" name="pw" pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" title="At least one number and one uppercase and lowercase letter, and at least 8 or more characters">
0 Comment(s)