Ads Top

Pattern for number in html

How to validate maximum number for the six digit or anything else.

type="number" min="100" max="999999"
It will show minimum to maximum number.

And second technique is type="text" pattern="\d*" maxlength="10"
It will work as a number and you can not type increase limit maximum 10 digits.

Both will work properly.

HTML Code 1:
<form>
    <input type="number" min="100" max="999999">
    <input type="submit">
</form>

HTML Code 2: 
<form>
    <input type="text" pattern="\d*" maxlength="10"> 
    <input type="submit">
</form> 

 

No comments:

Copyright Reserved to Anything Learn. Powered by Blogger.