https://github.com/amiel/sexy_creditcard_selector
when a valid credit card number is input to a text field, this jquery plugin calls a callback with the credit card company name
https://github.com/amiel/sexy_creditcard_selector
Last synced: about 1 year ago
JSON representation
when a valid credit card number is input to a text field, this jquery plugin calls a callback with the credit card company name
- Host: GitHub
- URL: https://github.com/amiel/sexy_creditcard_selector
- Owner: amiel
- Created: 2010-01-19T19:19:52.000Z (over 16 years ago)
- Default Branch: master
- Last Pushed: 2013-08-01T23:00:58.000Z (almost 13 years ago)
- Last Synced: 2024-10-03T12:33:08.590Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 102 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Sexy Credit Card Selector
When a valid credit card number is input to a text field, this jquery plugin calls a callback with the credit card company name. This allows for easy auto selecting of the credit card type when the user enters their credit card number.
### Example
```javascript
$('#credit_card_number').sexy_creditcard_selector(function(company){ alert("nice " + company + " card"); });
```
you can also pass a string or jQuery object:
```javascript
$('#credit_card_number').sexy_creditcard_selector('#credit_card_type');
// same as...
$('#credit_card_number').sexy_creditcard_selector(function(company){ $('#credit_card_type').val(company); });
```
### Configuration
```javascript
$.fn.sexy_creditcard_selector.credit_companies = [
"switch",
"visa",
"diners_club",
"master",
"forbrugsforeningen",
"dankort",
"laser",
"american_express",
"solo",
"jcb",
"discover",
"maestro"
]; // defaults to [ "visa", "master", "american_express", "discover" ]
```