简体   繁体   中英

Jquery validation stopped working

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 :)

只是删除function ().validate(function () {这应该工作...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM