jQuery Validation: Changing Rules Dynamically

后端 未结 10 920
栀梦
栀梦 2020-12-07 13:07

I have a single form that, depending on which radio button is clicked (Login or Signup), displays either:

  • email address
  • password

or:

10条回答
  •  不思量自难忘°
    2020-12-07 13:54

    try this..

    rules: {
        address: {
           required: {
                       depends: function(element) {
                         if (....){
                           return true;}
                         else{
                           return false;}
                       }
                     }
                 }
           }
    

    credit from here.

提交回复
热议问题