我在这个链接
http://alittlecode.com/files/jQuery-Validate-Demo/中实现了相同的验证
所以我在成功的元素旁边显示复选标记,有没有办法在表单加载时显示复选标记默认输入有效,仅在提交时显示错误?这是代码
$("#frmsubmit").validate({
rules: {
citstyle: "required",
spelling: "required",
uploadfile: {required: function (element) {
if($("#filesent").is(':checked'))
{
return false;
}
else
{
return true;
}
} ,
filesize: 8388608},
wordsno: "required",
cellphone: "required",
country: "required",
address: "required",
paytype: "required"
},
highlight: function(label) {
$(label).closest('.control-group').addClass('error');
},
success: function(label) {
label
.text('OK!').addClass('valid')
.closest('.control-group').addClass('success');
}
});
谢谢