How to perform validation on submit only - jQuery Validation plugin

后端 未结 2 1413
面向向阳花
面向向阳花 2021-01-03 01:14

I want the jQuery Validate plugin to only display the validation messages only upon form submit and not when the focus from a input field is lost. How do Ii achieve this?

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-03 01:20

    You need to disable all three handlers if you wish to receive absolutely no errors before submission and you can do validation like this:

    $('#commentForm').validate({
        onfocusout: false,
        onkeyup: false,
        onclick: false
    })
    

提交回复
热议问题