jquery validate 多个复选框

阅读更多

 

 




  
*

 

 

 

//表单验证
function validataForm(){
 var e=" ";
 uias_validator = $("#form_UIASManager").validate({
  rules:{
   resids: {required: true},
   role_name: {required:true,maxlength:50}
  },
  messages:{
   resids:e+"请至少选择一项资源",
   role_name:{required:e+"请输入标题", maxlength:e+"不能超过50字符"}
  },
  errorPlacement: function (error, element){
   if (element.is(':radio') || element.is(':checkbox')) { 
    var eid = element.attr('name');
    error.appendTo(element.parent()); 
   }else{
    error.insertAfter(element);
   }
  },
  submitHandler: function(form) {
   $('#form_UIASManager').form('submit', {
    url : xxxxxx,
    type: "POST",
    success : function(data) {
    
    }
   });
  }
 });
}

你可能感兴趣的:(jquery validate 多个复选框)