I have 2 divs
Its value is updated onclick
0.0301
This is main balance div
I am trying to update by adding both divs in this way
var totalscore = $("#balance p").text();
var currentscore = $("#cursoc p").text();
var bal = parseFloat(totalscore) + parseFloat(currentscore);
$("#balance p").html(bal);
Ins start it adds correct but After few clicks instead of adding it puts value after the balance like 0.00301000008 instead of adding 0.00301 + 0.000008
Am I doing parseFloat wrong way, need to know what is causing this
No comments:
Post a Comment