The period is the decimal point in the English language. If you want "17.000"
to be treated as seventeen-thousand and not seventeen, you have to remove the period:
var pay = +document.getElementById("name").innerHTML.replace(/\./g, '');
The unary plus (+
) at the beginning converts the resulting string into a number. This is not strictly necessary in your example but can avoid problems in the long run.
Using parseFloat
exposes the same problem as implicit type conversion.
If you want to format the number (i.e. convert it to a string with thousand separators) again, have a look at How to print a number with commas as thousands separators in JavaScript. Just use a period instead of a comma.
` tag. I'm trying to use `ParseFloat` but not working. Any idea?
– PlayHardGoPro Aug 11 '13 at 21:46