How to restrict user to type 10 digit numbers in input element?
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
Use maxlength
<input type="text" maxlength="10" />