我试图使用jquery javascript验证器,我根本无法解决此问题。有人可以看看这是一个问题
$('#BtnAdd').click(function( event ) {
$('#WorkOrderFrm').validate({
rules: {
Project_ID: {
required: true,
}
},
messages: {
Project_ID: {
required: "Please enter first",
}
},
submitHandler: function(form) {
$.ajax({
url: form.action,
type: form.method,
data: $(form).serialize(),
success: function(response) {
//$('#answers').html(response);
alert(response);
}
});
}
});
});
答案 0 :(得分:0)
您应该在$('#WorkOrderFrm').validate()
函数中调用$(document).ready()
,而不是click
处理程序。