P粉5879700212023-08-22 12:50:38
The parseFloat function of javascript does not accept regional parameters. So you need to replace ,
with
.
parseFloat('0,04'.replace(/,/, '.')); // 0.04
P粉6355097192023-08-22 00:17:29
This is "By Design". parseFloat
The function only considers parts of the string until it encounters a non- , -, number, exponent, or decimal point. Once it sees the comma, it stops looking and only considers the "75" part.
To fix this problem, convert commas to decimal points.
var fullcost = parseFloat($("#fullcost").text().replace(',', '.'));