Backspace not working when applying validation?
Hi I want to check all letters entered in a textbox to check that they are digits or not. this is the code I am using:
$(".numberInput").keypress(function(e) {
// if the letter is not digit then don't type anything if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) { return false; } });
This is working fine on IE 9, chrome, safari but in case of Mozilla, when I press Backspace key it always returns false.
Thanks Sahil
Hi
I want to check all letters entered in a textbox to check that they are digits or not. this is the code I am using:
$(".numberInput").keypress(function(e) {
// if the letter is not digit then don't type anything
if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
return false;
}
});
This is working fine on IE 9, chrome, safari but in case of Mozilla, when I press Backspace key it always returns false.
Thanks
Sahil