Issue
I want to create a input field for phone number. I am creating input field using JavaScript dynamically.
<input type="text" id="phone" name="phone">
How to restrict users to type only 10 digit numbers in order to get a phone number.
Solution
try this
<input type="text" name="country_code" title="Error Message" pattern="[1-9]{1}[0-9]{9}">
This will ensure
- It is numeric
- It will be max of 10 chars
- First digit is not zero
Answered By - Vinay Lodha
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.