Click here to Skip to main content
15,893,337 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to convert number to indian currency format ...It works perfactly for 0-9(48-57 ascii value)..bt for 0-9(97-105) it creates problem ny code is

C#
$('input.number').keyup(function(event) {

          // skip for arrow keys


      if (event.which >= 31 && event.which <= 48 || event.which > 57 && event.which <= 97 || event.which > 105) return;

          // format number

          $(this).val(function(index, value) {
              return value
                  .replace(/\D/g, '')
                  .replace(/(\d)(?=(\d\d)+\d$)/g, "$1,")
              ;
          });
      });



for 48 to 57 it gives output==1,111
bt for 97 to 105 it does attach comma at perfact place....i caaled this funnction onkeypress event of textbox..........and in 97 to 105 key it works after one backspace

....
Posted

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900