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
Try this:
My html:
Option 1
Option 2
Option 3
Option 4
My JQuery Code:
jQuery(".testall").click(function () {
if (jQuery(".checkbox:checked").length == 0) { alert("no riders"); }
});
Live example: http://jsfiddle.net/webwarrior/NJwv4/9/
This will give you the option to check only certain checkboxes.
hth, Shaun