Replace javascript does not work in general [duplicate]

1

Why when I do:

"1.000.000,00".replace('.','');

It returns me:

"1000.000,00"

How do I make it work with all the characters? which would look like this: "1000000,00"

    
asked by anonymous 30.07.2014 / 21:01

1 answer

2

Make a replace global with the option, change your replace , to:

"SILVANO SILVADO".replace(/A/g,'@');

Demo: JSFiddle

Edited

After editing the question, follow the new solution:

"1.000.000,00".replace(/\./g,'')

Demo: JSFiddle

    
30.07.2014 / 21:05