I have an input text form where it's required to insert a value from 1 to 10.
I tried to put a mask to customize it but it makes me write values over 10, how do I set the only possible values to be from 1 to 10 and not less or more?
The form input type="text" name="level" id="level"
The mask I used to make it accept only numbers and to make it 2 digits long
function maskFormatterForLvl(val) {
$(val).mask("ZZ", {
translation: {
'Z': {
pattern: /[0-9]/,
optional: true
}
}
});
};
I tried with the "max" attribute but it didn't work, probably because I'm new to JavaScript