The following input field doesn't allow numbers start with 0, but it can be beat by typing e.g. 10 or 20 or 100 or 2390. The important thing is that the number ends with 0, and the user can delete all the numbers before getting 0. Is there a way do avoid that? For example, when the remaining number is 0, it doesn't allow delete it.
$('#currency').inputmask({
regex: '^[1-9][0-9]*([,.][0-9]{1,2})?$',
rightAlign: false,
placeholder: '',
min: 1,
inputmode: 'decimal',
casing: function (elem) {
if(elem == ',') return '.';
return elem;
}
});
Codepen: https://codepen.io/levipadre/pen/gOQMKXW?editors=1010
Using key down in inputmask we can disable backspace by matching the value of the input field