I have a form with a series of checkboxes. I want to warn the user, after they hit submit, if ALL of the checkboxes are unchecked. I'm using the following code to report all of the values of the checkboxes:
$('[id^=leg_rider]').filter(':checked');
This seems to work. However, when I try to check to see if the returned object is empty, it doesn't seem to work. This is what I'm trying:
$("#set_pref_submit").click(function() {
var legchecked = $('[id^=leg_rider]').filter(':checked');
if (!legchecked){ alert("no riders")};
});
Any suggestions are appreciated. Thanks!