<script type="text/javascript">
$.validator.methods.checkboxGroup = function(value,element,param)
{
return (
$("input[name='length']").is(':checked') ||
$("input[name='density']").is(':checked') ||
$("input[name='packaging']").is(':checked') ||
$("input[name='loose']").is(':checked')
);
}
$('form').validate({
rules: {
length: "checkboxGroup",
density: "checkboxGroup",
packaging: "checkboxGroup",
loose: "checkboxGroup",
//etc
},
errorPlacement: function(err, el) {
var name = $(el).attr('name');
if (name == 'length' || name=='density' || name=='packaging' || name=='loose')
{
err.insertBefore(el);
}
else
{
err.insertAfter(el);
}
}
});
</script>