Currently, I am facing a slight issue. My goal is to only run the code when the input characters are numbers.
This is the snippet of code I have been working with:
$(".jq-sales, .jq-variablecosts, .jq-fixedcosts, .jq-additional-sales, .jq-sales-units, .jq-variablecosts-units, .jq-totalsold-units").keypress(function(event) {
if (event.keyCode >= 48 && event.keyCode <= 57 && event.keyCode >= 96 && event.keyCode <= 105) {
event.preventDefault();
}
else {
// Continue with my actions
}
});
What could be the issue in my code?
I am aiming to accurately detect input from both the numpad and the number keys above the keyboard as well.