javascript - Calculate sum of values -


I'm trying to get some values ​​in jQuery. I do this

  var sum = 0; $ ("Total") Text (zodiac + = parsint ($ ("numbers."). Text (), 10));  

But that is not making the amount I have tried the following which is not working?

  var sum = 0; $ ("Total") ParseInt (sum + = parseInt ($ (". Number"). Text (), 10));  

How can I calculate this amount?

Demo:

To sum up the values ​​you have to Need to be repeated. Issue element:

  var sum = 0; $ ('Number'). Each (function () {sum + = parseInt ($. Text (this), 10);}); $ ('Total') text (sum).  

Demo:


Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -