jquery.alphanum
jquery.alphanum copied to clipboard
maxLength does not work for .numeric() and type="number"
I want to add a max length to a numeric value, but its not working. I want to validate CVV number of credit cards, which should be a number, and only have 3 or 4 characters.
This is the code I used:
$('.payment-details-cvv').numeric({
maxLength: 4
});
I added a jsfiddle to illustrate that the maxlength works on type="text", but not type="number" and not with .numeric() http://jsfiddle.net/j8rvhdy5/3/
The same issue.
maxLength
is not allowed for type='number'
by design, check out this answer, and I think there is nothing to do with the alphanum plugin here,
the workaround that worked for me, is using the type='tel'
instead, which gives a slightly different (actually better :) ) keyboard, I think it will work with your requirement too.