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
You can use jQuery object's length property:
$("#set_pref_submit").click(function() { var legchecked = $('input[id^=leg_rider]:checked').length; if (legchecked){ alert("no riders")}; });