title: Why can't I use the top row of numbers on the keyboard?
body: <p>I have a script that formats my inputs to include decimals.  It seems I can only use my numpad to type numbers in with this script.  How can I make it so the numbers can be typed with the number pad or the number row at the top of the keyboard? and be formatted</p>
  
  <pre><code>$('input[name=PercentRate]').on('keydown',function(e){    
      // tab, esc, enter
      if ($.inArray(e.keyCode, [9, 27, 13]) !== -1 ||
          // Ctrl+A
          (e.keyCode == 65 &amp;&amp; e.ctrlKey === true) || 
          // home, end, left, right, down, up
          (e.keyCode &gt;= 35 &amp;&amp; e.keyCode &lt;= 40)) {
          return;
      }
  
      e.preventDefault();
  
      // backspace &amp; del
      if($.inArray(e.keyCode,[8,46]) !== -1){
          $(this).val('');
          return;
      }
  
      var a = ["a","b","c","d","e","f","g","h","i","`"];
      var n = ["1","2","3","4","5","6","7","8","9","0"];
  
      var value = $(this).val();
      var clean = value.replace(/\./g,'').replace(/,/g,'').replace(/^0+/, '');   
  
      var charCode = String.fromCharCode(e.keyCode);
      var p = $.inArray(charCode,a);
  
      if(p !== -1)
      {
          value = clean + n[p];
  
          if(value.length == 2) value = '0' + value;
          if(value.length == 1) value = '00' + value;
  
          var formatted = '';
          for(var i=0;i&lt;value.length;i++)
          {
              var sep = '';
              if(i == 2) sep = '.';
              if(i &gt; 3 &amp;&amp; (i+1) % 3 == 0) sep = ',';
              formatted = value.substring(value.length-1-i,value.length-i) + sep + formatted;
          }
  
          $(this).val(formatted);
      }    
  
      return;
  
  });    
  </code></pre>