How to replace comma with a dot in the number (or any replacement) [duplicate]

As replace() creates/returns a new string rather than modifying the original (tt), you need to set the variable (tt) equal to the new string returned from the replace function.

tt = tt.replace(/,/g, '.')

JSFiddle

Leave a Comment