Doubt about each () function

1

In the example below, the multiplication of the value of the checkbox (if checked) by the value chosen in the "select "of the same line, there is a" reset "of the respective" select "when unchecking the" checkbox "and there is a result in parallel only of the sum of the values of the select.

This code is the result of previous questions (classes) here in Stack, with the tips I managed to make it work perfectly.

My beginner question is if there is redundancy in the code this way I did and if it is possible to do everything with only one ()? As you can see, there are two "each ()":

$('tr').each(function(){ _código_ }); and $('table input').each(function(){ _código_ }); .

Here is a working example for a better understanding: link

Thanks in advance for helping me learn.

    
asked by anonymous 22.03.2016 / 13:50

0 answers