pattern attribute

<input pattern ='A-Za-z'>


Pattern attribute allows the user to place a pattern which can be matched by the value entered by user before the field is submitted.

Example Code:

Result :

Enter login code:
  • User can enter only the "alphabetical characters".
  • The value entered by user will be validated only when it matches the required value.
  • It is used to do regular expression i.e. to specify the pattern characters.


It will function only in Firefox, Opera and Chrome web browsers.

Ask Questions

Ask Question