jQuery-Plugins icon indicating copy to clipboard operation
jQuery-Plugins copied to clipboard

Delete key not working on decimal numbers

Open javarebel opened this issue 14 years ago • 0 comments

In Firefox if the value in the text box already have a decimal point, then delete key is not working. But back space key will work.

But delete will work in IE and Chrome.

I have a work around for this:

Here is the code snippet I put:

    if(key == decimal.charCodeAt(0)) {
      if(!this.containsDecimal) {
       allow = true;
       this.containsDecimal = true;
      } else    {
      if(key == 46) {
                  if(e.charCode == 0) return true;
                  if(this.containsDecimal) return false;
                  return true;
      }
      allow = false;
      }
    }

javarebel avatar Apr 07 '11 20:04 javarebel