jquery验证器creditcardtypes用法

时间:2014-12-17 02:07:54

标签: jquery jquery-validate

我尝试使用jquery.validator插件来验证信用卡类型和信用卡号码,以便它们匹配。例如,验证Visa号码,信用卡类型为Visa。

我只需要知道如何传递信用卡类型,以便信用卡号码仅用于该类型的信用卡通过验证:

这是我目前的代码

$jq('#frmCompleteOrder').validate({

      // Specify the validation rules
      rules: {
          txtCardholderName: {
              required: true,
          },
          txtCardNumber: {
              required: true,
              creditcard: true,
              creditcardtypes: {type:'visa'} <-- how do I pass the credit card type here
          },
          selShippingState: {
              required: true,
              select_one: true
          }
      },

      // Specify the validation error messages
        messages: {
            txtCardholderName: {
              required: "Please enter a value for Card Holder Name",
              minlength: "Card Holder Name must be at least 5 characters long"
          }
      },

      submitHandler: function(form) {
          form.submit();
      }
}); //validate

0 个答案:

没有答案