CreditCard v1.0

This plugin provides support for validation input number credit card.



Details

Author
Adrian Statescu
Current version
v1.0
GitHub
thinkphp/CreditCard
Downloads
3757
Category
Utilities
Tags
Report
GitHub Issues

Releases


Dependencies

  • core/1.3: *

How to use

First you must to include the JS files in the head of your HTML document.

        #HTML
        <script type="text/javascript" src="mootools.js"></script>
        <script type="text/javascript" src="creditcard.js"></script>

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     

Discuss

A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.

Found a bug in this plugin? Please report it this repository's Github Issues.

blog comments powered by Disqus