Mozilla サポートの検索

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

このスレッドはアーカイブに保管されました。 必要であれば新たに質問してください。

Backspace not working when applying validation?

  • 返信なし
  • 1 人がこの問題に困っています
  • 1 回表示
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

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