Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/PawelDecowski/jquery-creditcardvalidator
jQuery credit card validation and detection plugin
https://github.com/PawelDecowski/jquery-creditcardvalidator
Last synced: 12 days ago
JSON representation
jQuery credit card validation and detection plugin
- Host: GitHub
- URL: https://github.com/PawelDecowski/jquery-creditcardvalidator
- Owner: PawelDecowski
- License: mit
- Created: 2012-02-19T20:25:47.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2023-02-01T22:33:03.000Z (almost 2 years ago)
- Last Synced: 2024-10-29T15:27:12.863Z (13 days ago)
- Language: JavaScript
- Homepage: jquerycreditcardvalidator.com
- Size: 530 KB
- Stars: 1,054
- Watchers: 62
- Forks: 275
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# jQuery Credit Card Validator
jQuery Credit Card Validator detects and validates credit card numbers. It’ll tell you the detected credit card type and whether the number length and Luhn checksum are valid for the type of card.
## Installation
### NPM
```bash
npm i jquery-creditcardvalidator
```### Download
Download the latest [jquery.creditCardValidator.js](https://raw.githubusercontent.com/PawelDecowski/jquery-creditcardvalidator/master/jquery.creditCardValidator.js).
The latest stable version is always in the [master branch](https://github.com/PawelDecowski/jquery-creditcardvalidator/tree/master). If you need previous versions, you’ll find them on the [releases page](https://github.com/PawelDecowski/jquery-creditcardvalidator/releases).
Do not use any branches other than [master](https://github.com/PawelDecowski/jquery-creditcardvalidator/tree/master). Branches starting with `release/` are development branches and they will most likely be broken.
## How to use
Run validation every time a field value changes:
```js
$('#cc_number').validateCreditCard(function(result) {
if (result.valid) {
$(this).addClass('cc-valid');
} else {
$(this).removeClass('cc-valid');
}
});
```Run validation once:
```js
const result = $('#cc_number').validateCreditCard();if (result.valid) {
$(this).addClass('cc-valid');
} else {
$(this).removeClass('cc-valid');
}
```## Documentation
For full documentation see the [jQuery Credit Card Validator website](http://jquerycreditcardvalidator.com/).