开发者

Disable Jquery validation [duplicate]

开发者 https://www.devze.com 2022-12-09 18:44 出处:网络
This question already has answers here: jQuery Validation plugin: disable valida开发者_StackOverflow社区tion for specified submit buttons
This question already has answers here: jQuery Validation plugin: disable valida开发者_StackOverflow社区tion for specified submit buttons (12 answers) Closed 6 years ago.

I am using jQuery validation plugin for UI validation. I have a Jquery menu to select the type of transaction. On certain menu selection there should not be any validation happening. I am not sure if there is a way to tell Jquery validation to be disabled

I am using a following ways for the validation

1) $.validator.addMethod()

2) $.validator.addClassRules()

3) $("#submitButton").validate({ rules: { some rules }, messages: { some messages }

on click of the submit button for a particular menu selection i want the validation to be turned OFF. Is there a way to achieve this?


This answer should be what you're looking for: add class="cancel" to your submit button when the transaction type is changed to one you don't want validated. And when it's changed to a transaction type you do want validated, just remove the class.

0

精彩评论

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

关注公众号