I like to have an input with maximum 3 characters. In Firefox everything works fine I can only write 3 numbers inside the input - but in safari you can write a lot of number
Here is a more simple solution. For me it worked
$("#cvv").on("keypress", function(evt) {
var keycode = evt.charCode || evt.keyCode;
if (keycode == 46 || this.value.length==3) {
return false;
}
});
the JS block will prevent the "."(dot) so one cant enter float. We are keeping the input type as number so it will be only number as input. If the value length is 3 then it will return false, so input length also restricted.