开发者

Jquery validate (active/inactive)

开发者 https://www.devze.com 2023-03-18 09:35 出处:网络
I\'m using jquery validate plugin to control a form. My question is how can I activate or deactivate the validate plugin through a checkbox or radio buttons?

I'm using jquery validate plugin to control a form.

My question is how can I activate or deactivate the validate plugin through a checkbox or radio buttons? The form in default mode is controlled 开发者_Python百科by the plugin, and the user has an option to deactivate the form control.

Thanks again for sharing your knowledge!


This should give you all the information you need: Form Validator

But you could make something similar to :

$('#checkBox').change(function() {
    if ($('#checkBox').attr('checked')) {
        var validator = $("#myform").validator();
        validator.destroy();
    }
    else
         $("#myform").validator();
});
0

精彩评论

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