When using an input text form, I need to ensure that users only insert values ranging from 1 to 10.
However, my attempts to utilize a mask for customization have resulted in allowing values higher than 10. How can I restrict the input to only be allowed between 1 and 10?
The form:
The mask I employed to accept only numbers and limit it to 2 digits:
function maskFormatterForLvl(val) {
$(val).mask("ZZ", {
translation: {
'Z': {
pattern: /[0-9]/,
optional: true
}
}
});
I attempted to use the "max" attribute without success, likely due to my limited experience with JavaScript.