Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.52 KB | None | 0 0
  1. function calculate_day(day_values){
  2.     var sum = [].reduce.call(
  3.       day_values.querySelectorAll('input.timer_input'),
  4.      (res, node) => res + +(node.value || 0),
  5.      0
  6.     );
  7.     return sum
  8.   }
  9.  
  10.   $('body').bind('onload change', '.timer_input', function() {
  11.     $('.tab-content .table_index').each(function() {
  12.       var sum = calculate_day(this);
  13.       var id = $(this).find('.sum_total').text(sum).closest('.tab-pane').attr('id');
  14.       $('a[href="#' + id + '"].sum_total').text(sum);
  15.     });
  16.   }).change();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement