问题
In my validation rules, I have the following code:
CardNumber:{
required:function(element){ return validateIfDeposit();},
creditcard2: function(){ return $('#CardType').val(); }
},
The required function works great (I use it successfully for the nameOnCard field). Unfortunately the CardNumber field is still coming back invalid. How can I have the credit card field be valid if the field is not required?
来源:https://stackoverflow.com/questions/9068588/jquery-validate-creditcard2-how-to-only-validate-the-credit-card-if-the-card-is