Wordpress magazine themes - Debt Consolidation - Deaf Topics - Internet Advertising - Find jobs

PDA

View Full Version : to remove commas from number


leoparamundayil
Apr 17th 2007, 1:31 am
hai all,

when iam getting value to a page the number format is 12,345,678
earlier i was using IsNumeric function..but now the number format has changed as mentioned earlier.

can someone give a solution to get only the number to submit it to database

Subikar
Apr 17th 2007, 9:17 am
Number = '12,345,678';
Number = Number.replace(/,/gi,””);


This will help you my friend as much as I know. :)

krakjoe
Apr 17th 2007, 1:07 pm
Number is a keyword in javascript you cannot use it.

I dunno if its your keyboard or the forum but your quotes got replace with backticks or something.


<script language="javascript">
var num = '12,345,678';
num = num.replace(/,/gi,"");
alert( num );
</script>

Subikar
Apr 17th 2007, 10:10 pm
ohh thats great "krakjoe's" thanks for correcting my code. :)