I have taken the code provided in the help documentation and have the following function:
$('.cf-table-block').on('blur change', '.domain3Sum select', domain3sumtotal); function domain3sumtotal() { var s = 0; $('.domain3Sum select').each(function () { s += parseNumber($(this).val()); }); $('.domain3Subtotal input').val(s); } function parseNumber(n) { var f = parseFloat(n); //Convert to float number. return isNaN(f) ? 0 : f; //treat invalid input as 0; }
It calculates the number correctly. Now I need to take the sum of the .domain3Sum fields and divide them by specific number like 3. How do I alter the code to do that and then put that in the .domain3Subtotal field?