Reputation: 35
i am using below line of code to restrict the user but not working for iphone maxlength ="4";
<input type="number" name="securitycode" id="securityCode" maxlength="4" />
Is there any way to enforce this on iOS?
Upvotes: 2
Views: 2894
Reputation: 2905
This is a known issue. One work around is to use jQuery to restrict this.
$('input[name="securitycode"]').keypress(function() {
if (this.value.length >= 4) {
return false;
}
});
Upvotes: 1