Reputation: 45737
Is there a way in jQuery to know if at least one checkbox has been checked?
I have a form with a lot of checkboxes and each one is different.
I need a way with jQuery to say something like this, this is the logic:
If at least one of the checkboxes in this specific form has been checked, then DO THIS else DO THAT.
I repeat each checkbox has a different name, id and value. So I need something generic.
Instead the form is only one and the ID is #tuitting_form
Thanks!!
Upvotes: 2
Views: 614
Reputation: 69905
Try this
$(document).read(function(){
$("#tuitting_form input:checkbox").live('click', function(){
if( $("#tuitting_form input:checkbox:checked").length > 0){
$("#send_message").show(); $("#remove_accounts").show();
}
});
});
Upvotes: 5