https://github.com/thinkphp/creditcard
A plugin MooTools for credit card validation
https://github.com/thinkphp/creditcard
Last synced: 1 day ago
JSON representation
A plugin MooTools for credit card validation
- Host: GitHub
- URL: https://github.com/thinkphp/creditcard
- Owner: thinkphp
- Created: 2010-10-08T12:20:17.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2010-10-25T08:29:08.000Z (over 15 years ago)
- Last Synced: 2025-06-07T11:37:09.613Z (8 months ago)
- Language: JavaScript
- Homepage: http://thinkphp.ro/apps/js-hacks/creditcard/
- Size: 109 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
CreditCard
==========
This plugin provides support for validation input number credit card.

How to use
----------
First you must to include the JS files in the head of your HTML document.
#HTML
In your JavaScript code.
#JS
if(window.console) {
var visa = new CreditCard("4012 8888 8888 1881");
console.log(visa.isValid());
console.log(visa.getType());
console.log(visa.isVisa());
var ms = new CreditCard("5105 1051 0510 5100");
console.log(ms.isValid());
console.log(ms.getType());
console.log(ms.isMasterCard());
var am = new CreditCard("371449635398431");
console.log(am.isValid());
console.log(am.getType());
console.log(am.isAmericanExpress());
var am = new CreditCard("6011111111111117");
console.log(am.getType());
var card = new CreditCard("4111111111111112");
if(card.isValid()) {
console.log('The card is valid!');
}else{
console.log('the card is not valid!');
}
}//end if window.console