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

python - Writing Greek in matplotlib labels, titles -

c# - LINQ to Entities does not recognize the method 'Int32 IndexOf(System.String, System.StringComparison)' method -

Pygame memory leak with transform.flip -