Don't know why it doesn't work. jquery isn't adding them up. It displays just 00. I'm using rails 4.
# application.js
var sum = 0;
$('.sum1').each(function() {
sum += +$(this).text()||0;
});
$("#sum1_total").text(sum);
# view
<% @modification.boxes.each do |d| %>
<tr class="sum">
<td><%= best_in_place d, :shares, :type => :input, :class => :sum1 %></td>
</tr>
<% end %>
<tr>
<td><span id="sum1_total">00</span></td>
</tr>