HTML 5 Input :
<input type="text" pattern="[0-9]{1,3}" value="" />
By using pattern attribute in html5 specifies a regular expression that the element's value is checked against.
Note: The pattern attribute works with the following input types: text, search, url, tel, email, and password.
[0-9] can be replaced with any regular expression condition.
{1,3} it represents minimum of 1 and maximum of 3 digit can be entered.
[0-9] can be replaced with any regular expression condition.
{1,3} it represents minimum of 1 and maximum of 3 digit can be entered.
No comments:
Post a Comment