1calc_total();
2
3$(".choose").on('change', function(){
4 var parent = $(this).closest('tr');
5 var price = parseFloat($('.price',parent).text());
6 var choose = parseFloat($('.choose',parent).val());
7
8 $('.total',parent).text(choose*price);
9
10 calc_total();
11});
12
13function calc_total(){
14 var sum = 0;
15 $(".total").each(function(){
16 sum += parseFloat($(this).text());
17 });
18 $('#sum').text(sum);
19}