0

I have 2 divs

 <div id="cursoc"><p><?php echo $myresultf; ?></p></div>

Its value is updated onclick

<div id="balance"><p>0.0301</p></div>

This is main balance div
I am trying to update <div id="balance"></div> 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

john
  • 107
  • 9

1 Answers1

0

There is no any mistake in your code and it should work. It is really an issue, not your fault.

See:

Community
  • 1
  • 1
Taufik Nur Rahmanda
  • 1,862
  • 2
  • 20
  • 36