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
Working Demo : http://jsfiddle.net/MrkfW/
Try this: using .change api as well so it keep the track :)
API: http://api.jquery.com/change/
$("input[type='checkbox'][id^=leg_rider]").change(function(){
var a = $("input[type='checkbox'][id^=leg_rider]");
if(a.length == a.filter(":checked").length){
alert('all checked');
} else {
alert('not all checked');
}
});