Created
July 19, 2011 16:09
-
-
Save antoniorosado/1092919 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Add a method to the validator that checks to see if at least one of the | |
// three checkboxes specified are checked. | |
jQuery.validator.addMethod('atLeastOneChecked', function(value, element) { | |
var checkedCount = 0; | |
if (jQuery('#checkBoxListOne').is(':checked')){ | |
checkedCount += 1; | |
} | |
if (jQuery('#checkBoxListTwo').is(':checked')){ | |
checkedCount += 1; | |
} | |
if (jQuery('#checkBoxListThree').is(':checked')){ | |
checkedCount += 1; | |
} | |
return checkedCount > 0; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment