Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Lolu chungechunge lwabekwa kunqolobane. Uyacelwa ubuze umbuzo omusha uma udinga usizo.

Backspace not working when applying validation?

  • Akukho zimpendulo
  • 1 inale nkinga
  • 1 view
more options

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