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:

  1. number($('#textbox1').val()).tofixed(2).replace(/\b(?=(\d{3})+(?!\d))/g, ",")
  2. 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

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -