jquery对重复行数组中的所有值求和

jquery对重复行数组中的所有值求和,jquery,Jquery,大家好,我找不到解决方案 <tr><td> Some Code here <input name="forwardings[nodes][amount][]" class="repeatingClass"> some more code here </td> </tr> <tr><td> Some Code here <input name="forwardings[nodes][amount][]" cl

大家好,我找不到解决方案

<tr><td> Some Code here <input name="forwardings[nodes][amount][]" class="repeatingClass"> some more code here </td> </tr>
<tr><td> Some Code here <input name="forwardings[nodes][amount][]" class="repeatingClass"> some more code here </td> </tr>
<tr><td> Some Code here <input name="forwardings[nodes][amount][]" class="repeatingClass"> some more code here </td> </tr>
我能做什么?
输入中的空值被解释为字符串。因此,您应该首先检查是否有值,如果有,则在调用
parseInt
parseFloat

$(function(){

     $('.repeatingClass').focusout(function(){
         var totalPoints = 0;

       $('.repeatingClass').each(function(){

           if ($(this).val())
               totalPoints += parseInt($(this).val());
       });

       alert(totalPoints);

     });

});
他是一把小提琴

$(function(){

     $('.repeatingClass').focusout(function(){
         var totalPoints = 0;

       $('.repeatingClass').each(function(){

           if ($(this).val())
               totalPoints += parseInt($(this).val());
       });

       alert(totalPoints);

     });

});