Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

at leastone checkbox required jquery

$.validator.addMethod("roles", function(value, elem, param) {
   return $(".roles:checkbox:checked").length > 0;
},"You must select at least one!");

<input class='{roles: true}' name='roles' type='checkbox' value='1' />
  
 
PREVIOUS NEXT
Tagged: #leastone #checkbox #required #jquery
ADD COMMENT
Topic
Name
9+2 =