我的代码中有一个JQuery验证,它验证了我的字段但是当我按下提交按钮时,JQuery submitHandler()没有执行。
这是我的代码。
$(document).ready(function () {
$("#stdRegFrm").validate({
debug: true,
rules: {
applicantFirstName: {required: true, minlength: 2},
applicantaddmissionno: {required: true, minlength: 2,remote:{url: 'jsp/checkadmno.do', type: "POST", contentType : "application/x-www-form-urlencoded; charset=UTF-8", data: {addmissionno: function(){ return $("#applicantaddmissionno").val();}},}},
applicantMiddleName: {required: true, minlength: 2}
},
messages: {
applicantFirstName: {required: 'This field is required', minlength: 'Minimum length: 2'},
applicantMiddleName: {required: 'This field is required', minlength: 'Minimum length: 2'},
applicantaddmissionno:{required: 'This field is requaired!', minlength: 'Minimum length: 2', remote:'student admission no. already exist'},
},
success: function(label) {
label.html('ok').removeClass('error').addClass('ok');
setTimeout(function(){label.fadeOut(500);}, 2000);
},
submitHandler:function(form) {
alert($('#applicantFirstName').val());
},
});
});