How To Detect Credit Card Type And Validate Numbers Using jQuery

It's only fair to share...Share on Facebook0Share on Google+33Tweet about this on Twitter0Share on LinkedIn1Pin on Pinterest0Digg thisShare on StumbleUpon1

credit card validator

We all are working on shopping cart application or any other website having transaction using credit card. We always required client side validation to verify credit card type or user using valid card number. In this tutorial we are going to show you that how to detect credit card type and validate credit card number using jQuery. It will display the type of detected credit card and calculate the length of card number by its type.

To achieve this we are using jQuery Credit Card validator library.

include jquery library:

 Create input box to capture credit card number:

Initialize validation library and add / remove class from text field to show credit card image :

Testing Credit Card Numbers:

American Express – 378282246310005
American Express – 371449635398431
American Express Corporate – 378734493671000
Diners Club – 30569309025904
Diners Club – 38520000023237
Discover – 6011111111111117
Discover – 6011000990139424
JCB – 3530111333300000
JCB – 3566002020360505
MasterCard – 5555555555554444
MasterCard – 5105105105105100
Visa – 4111111111111111
Visa – 4012888888881881
Visa – 4222222222222



  1. By Tezz


Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">