A credit card validator for Parsley.js including validation for specific brands
This plugins offers validation for the following credit card brands:
- Amex
- China Union Pay
- Dankort
- Diners Club CarteBlanche
- Diners Club International
- Diners Club US & Canada
- Discover
- JCB
- Laser
- Maestro
- Mastercard
- Visa
- Visa Electron
If you just want to check if the credit card number is valid, simply add the data-parsley-creditcard attribute to your input:
<input required="required" data-parsley-creditcard="" type="tel">
If you want to check if the credit card number is valid and also check if is for a specific brand, simply add the data-parsley-creditcard attribute to your input with the value as the allowed brands, separeted with commas:
<input required="required" data-parsley-creditcard="visa,mastercard" type="tel">
To validate the card cvc code, add the data-parsley-cvv attribute to your input:
<input required="required" data-parsley-cvv="" type="tel">
To validate the card expiry date, add the data-parsley-expirydate attribute to your input:
<input required="required" data-parsley-expirydate="" type="tel">