Hello everyone, I need your assistance. I need to format a numeric value to contain comma and decimal. I found this jquery (below) but it does not have a decimal. Can someone help me with how to add a decimal place? thank you.
- function FormatCurrency(ctrl) {
-
- if (event.keyCode == 37 || event.keyCode == 38 || event.keyCode == 39 || event.keyCode == 40) {
- return;
- }
-
- var val = ctrl.value;
-
- val = val.replace(/,/g, "")
- ctrl.value = "";
- val += '';
- x = val.split('.');
- x1 = x[0];
- x2 = x.length > 1 ? '.' + x[1] : '';
-
- var rgx = /(\d+)(\d{3})/;
-
- while (rgx.test(x1)) {
- x1 = x1.replace(rgx, '$1' + ',' + '$2');
- }
-
- ctrl.value = x1 + x2;
- }
-
- function CheckNumeric() {
- return event.keyCode >= 48 && event.keyCode <= 57;
- }