If you want to prevent a user to mark more than, for example, 4 checkboxes, you can use:
$("input[type=checkbox][name=subculture]").click(function() {
var bol = $("input[type=checkbox][name=subculture]:checked").length >= 4;
$("input[type=checkbox][name=subculture]").not(":checked").attr("disabled",bol);
});
But if my checkboxes are an Array like:
<input type="checkbox" value="option1" id="attachments[29][subculture][]" name="attachments[29][subculture][]" />option1
<input type="checkbox" value="option2" id="attachments[29][subculture][]" name="attachments[29][subculture][]" />option2
<input type="checkbox" value="option3" id="attachments[29][subculture][]" name="attachments[29][subculture][]" />option3
...
How can I fix the above Jquery code to validate something like that?
where 29 is the ID of the actual post edited.
Thanks in advance.