In my form i have two radio buttons(seller and buyer).same form fields for both radio buttons. But the diffrence is while i click buyer radio button some fields will hide i used javascript for hide that. Then i used jquery form validation.Also used jquery validation for hide fields. In seller mode the form is submitted sucessfully.In buyer mode while i cli开发者_高级运维ck submit button jquery also validate hide fields. I want to stop validate in buyer mode. How i do that?
You can call validate
function with different options in handler, that switches buyer/seller mode. Or you can add/remove rules in that handler
I assume you are using something like
$("#myForm").validate();
to validate the form; you can pass an option to validate() to ignore certain elements. So, for example, if all your elements that get hidden have the class ".hideForBuyer" then something like the following will ignore them:
$("#myForm").validate({
ignore: ".hideForBuyer"
})
See partway down http://docs.jquery.com/Plugins/Validation/validate#toptions
精彩评论