Fixed javascript syntax errors on for loop
Missed if condition to ensure that check only runs when data or count is not checked but not both