From the function's definition (http://www.w3schools.com/jsref/jsref_replace.asp):
The replace() method searches a string for a specified value, or a
regular expression, and returns a new string where the specified
values are replaced.
This method does not change the original string.
Hence, the line: tt.replace(/,/g, '.')
does not change the value of tt
; it just returns the new value.
You need to replace this line with: tt = tt.replace(/,/g, '.')