I have the following table...
Outside of the table I have fields that total the number of Council Meetings, etc., within the event column.
I have used JavaScript to count the number of "Event Types" for each selection listed. I have just found out that I need to make the increment value equivalent to the Per Diem (within the same row) selected by the user. The values are either 0.5 or 1.
Can I increment based on a variable? If so, how do I reference it within the table?
Here is the code I used to count...
function countCheck(column,valueToCount) { var count = 0; $('#q20 tr td[data-title="'+column+'"] input:checked').each(function() { if($(this).val() == valueToCount) { count += 1; } }); return count; } $(document).ready(function() { $(document).on('change','#q20 tr td[data-title="Event Type"] input',function(){ $('.TotCouncil input[type="text"]').val(countCheck('Event Type','Council')) $('.TotOther input[type="text"]').val(countCheck('Event Type','Other')) $('.TotComm input[type="text"]').val(countCheck('Event Type','Committee')) }); });
I am not skilled at coding. This code was a result of the generosity of those on Laserfiche Answers. I appreciate the help!