Javascript parse float is ignoring the decimals after my comma
javascript's parseFloat doesn't take a locale parameter. So you will have to replace ,
with .
parseFloat('0,04'.replace(/,/, '.')); // 0.04
This is "By Design". The parseFloat
function will only consider the parts of the string up until in reaches a non +, -, number, exponent or decimal point. Once it sees the comma it stops looking and only considers the "75" portion.
- https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/parseFloat
To fix this convert the commas to decimal points.
var fullcost = parseFloat($("#fullcost").text().replace(',', '.'));