I need to modify this CSS masking method so that when the user types in this input field, they can only enter values between -9999999 to 9999999.
The input field cannot be type=number, it has to be type=text. This would be the easiest way to go about this, however, this is a business requirement, that all input fields must look the same.
Here is the current masking method that needs to be modified:
maskInputAmount(e) {
const t = e.target.value.replace(/\[a-z]/g, '').match(/(-?)(\d{0,8})/);
e.target.value = t[2] ? (t[1] + t[2]) : t[2];
}
How can I modify this so that any value -9999999 to 9999999 is valid?