My code:
var $label = $(ev.currentTarget);
var $price = $label.parent("form").find(".oe_price .oe_currency_value");
if (!$price.data("price")) {
$price.data("price", parseFloat($price.text()); //price is 10.30 but it returns 10.3 as number
}
$price.html($price.data("price")+parseFloat($label.find(".badge span").text() || 0));
/* The value coming in **badge** is **12.00**
* but parseFloat converts that into **12**
* thats why after the addition I got the output as **22.3**
* but i want it as **22.30**
*/
I have a string
'10.30'
Now, if I convert the string to number using parsefloat
parseFloat('10.30')
I got the output as 10.3
And If I do it using the .tofixed(2)
parseFloat('10.30').toFixed(2)
I got the output 10.30 but it is in STRING which is the big problem for me because I want the output as number.
And if i do like this
Number(parseFloat('10.30').toFixed(2))
I got the output 10.3
But i want the output in number and with decimal point like this 10.30
Plz help...!!!