I'm implementing the same validation in this link
http://alittlecode.com/files/jQuery-Validate-Demo/
So I display check marks next to elements on success, is there a way to display the checkmarks on form load when it has valid input by default, and display errors only on submit ?
here is the code
$("#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');
}
});
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…