Use this to validate credit card numbers. Dashes are ignored, so users may input them if they like. Tests for Visa, Mastercard, Amex, Discover, JCB, and Diners Club. Uses two hidden fields to store the type of card entered and whether or not the number entered is a valid credit card number. Regex source: http://stackoverflow.com/questions/72768/how-do-you-detect-credit-card-type-based-on-number
A Pen by Jon Crowell on CodePen.