-1

I get a number format string from an input box like: 1,033.00 How can I convert it to 1033 by jquery/javascript? I have to use this converted number to add it with another number.

stockBoi
  • 287
  • 2
  • 9
  • 26

1 Answers1

0

You can do a string replace numberString= numberString.replace ( /[^0-9]/g, '' );

To add it to another number you can use + operator to convert the numberString to a number value.

var numberString= numberString.replace ( /[^0-9]/g, '' ); var addition = +numberString + anotherNumber;

Pramod Karandikar
  • 5,289
  • 7
  • 43
  • 68