在TD中对多个值求和

时间:2013-02-21 11:04:04

标签: jquery sum

我想获得一些值的总和平均值,但我已经坚持开始使用jQuery了。 这是因为我想要的值在同一个表中。

有人可以帮助我从这开始吗?

我的例子: http://jsbin.com/inapey/2/edit

1 个答案:

答案 0 :(得分:0)

$(document).ready(function(){
  var total = 0;
  $('#ritten tr .single_ride').each(function() {
  var ritkm = $(this).html();
  total = total + parseInt(ritkm);
  });
   alert(total);  
});