jQuery Validation plugin: disable validation for specified submit buttons

后端 未结 12 767
故里飘歌
故里飘歌 2020-11-22 16:14

I have a form with multiple fields that I\'m validating (some with methods added for custom validation) with Jörn Zaeffere\'s excellent jQuery Validation plugin. How do you

12条回答
  •  Happy的楠姐
    2020-11-22 16:42

    $("form").validate().settings.ignore = "*";
    

    Or

    $("form").validate().cancelSubmit = true;
    

    But without success in a custom required validator. For call a submit dynamically, i have created a fake hidden submit button with this code:

    var btn = form.children('input.cancel.fakeSubmitFormButton');
    if (btn.length === 0) {
        btn = $('');
        form.append(btn);
    }
    btn.click();
    

    Now skip the validation correctly :)

提交回复
热议问题