How to convert long number string value to numeric value using Javascript / jQuery -
user allowed insert 25 value in textbox
.
i.e. 1234567890123456789012345
on change event of textbox need convert same numeric value perform numeric operations , after need display same entered value thousand separator along 2 decimal places.
i tried following code:
number($('#textbox1').val()).tofixed(2).replace(/\b(?=(\d{3})+(?!\d))/g, ",")
parseint($('#textbox1').val(), 10).tofixed(2).replace(/\b(?=(\d{3})+(?!\d))/g, ",")
both gives me following output
1.2,345,679,801,234,568e+21
expected output:-
1,234,567,890,123,456,789,012,345.00
try using autonumeric js. find here
Comments
Post a Comment