Is it possible to combine a pattern attribute with a maxlength attribute on an input field in jquerymobile?
<input name="aNumber" type="number" pattern="[0-9]{6}" maxlength="6" placeholder="dddddd" value="">
<input name="anotherNumber" type="number" pattern="[0-9]{3,4}" maxlength="4" placeholder="ddd(d)" value="">
I want the big numberpad to appear but that only works using pattern="[0-9]*"
. Unfortunately the maxlength attribute is not respected in any case.
What I want is a numeric keypad to appear (the big one/dial; the iPhone apparently has two: only numbers/dial and numbers with special chars) letting the user input up to 6 or 3 to 4 numeric chars.
Edit: Applied @raina77ow 's suggestion and that works for the moment, but still it feels not right so I'm open to advice!
<input name="aNumber" type="tel" pattern="[0-9]*" maxlength="6" placeholder="dddddd" value="">
{6} means exactly 6 Digits {0,6} means minimum 0 digits and maximum 6 digits
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With