Hey all. I've been been trying to figure this out for a while now.
I create a jQuery object of checkboxes and store it in a variable:
$group1 = $('#checkbox1,#checkbox2,#checkbox3,#checkbox4');
The user cannot continue unless all checkboxes in that group are checked.
I've been using an if statement combined with .is(':checked')
to find a boolean value:
if( $group1.is(':checked') ){
//continue is OK
}
...but .is(':checked')
will return TRUE
if any checkboxes are checked within the group. Essentially, .is(':checked')
performs an OR operation on the selected elements in $group1. I'm looking for an AND operation, so all selected elements must be checked to return TRUE
. Is there a jQuery function that does this, or another workaround?