if any checkbox is checked in a checkbox array

if any checkbox is checked in a checkbox array

Hello and thank you to those who have helped me in the past.  I'm having a brain issue in reversing logic that I have successfully used in the past.  

What I need to do:

I have a checkbox array.  If any of the checkboxes ( freeform_ch_cla_course_preferences_courses_001_1 -  freeform_ch_cla_course_preferences_courses_001_5) are checked, I would like to addClass to a textarea (id=" 101").

Unfortunately, the code I have below, only works to toggle the validation.

Thank you for any help in advance.
Peter T


  1. $("#freeform_ch_cla_course_preferences_courses_001_1, #freeform_ch_cla_course_preferences_courses_001_2, #freeform_ch_cla_course_preferences_courses_001_3, #freeform_ch_cla_course_preferences_courses_001_4, #freeform_ch_cla_course_preferences_courses_001_5").change(function() {
  2. var checked =this.checked
  3. $("#101").addClass("required error", checked);//large_field_007
  4. $("#student-activities").show();
  5. if(!checked){
  6. $("#101").removeClass("required error", checked);//large_field_007
  7. $("#101").val("");//large_field_007
  8. $("#student-activities").hide();
  9. }
  10. }).change();