I have a form with a series of checkboxes. I want to warn the user after they click submit if ALL the boxes are unchecked. I use the following code to report all flag values:
$('[id^=leg_rider]').filter(':checked');
It seems to work. However, when I try to check if the object returned is not working. This is what I am trying:
$("#set_pref_submit").click(function() {
var legchecked = $('[id^=leg_rider]').filter(':checked');
if (!legchecked){ alert("no riders")};
});
Any suggestions are welcome. Thank!
source
share