这是我对验证函数的调用。使用此代码一切正常。
$('#createForm').validate(function () {
});
但是当我尝试稍微修改它时,整个验证停止工作:
$('#createForm').validate(function () {
errorPlacement: function(error, element) {
error.insertAfter(element);
},
debug:true
});
有什么想法吗?
最佳答案
你不应该在那里有function()。将其更改为:
$('#createForm').validate(
{
errorPlacement: function(error, element) {
error.insertAfter(element);
},
debug:true
}
);
{ } 中的内容是选项。这不是一个函数:)
关于javascript - Jquery 验证停止工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3344274/