开发者

Jquery validation stopped working

开发者 https://www.devze.com 2023-01-08 20:53 出处:网络
here\'s my call to the validate function. Everything works fine 开发者_开发问答with this code.

here's my call to the validate function. Everything works fine 开发者_开发问答with this code.

$('#createForm').validate(function () {
});

But when I try to modify it a bit, the whole validation stop working:

$('#createForm').validate(function () {
               errorPlacement: function(error, element) {
                 error.insertAfter(element);
               },
               debug:true

            });

Any Idea?


you shouldn't have function() in there. change it to:

$('#createForm').validate(
    {
         errorPlacement: function(error, element) {
                 error.insertAfter(element);
         },
         debug:true

      }
);

the stuff in the { } is the options. it's not a function :)


just remove function () in .validate(function () { and that should work...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号