A CodePen by Dave Levine. Autodetect Credit Card - This code auto detects a users credit card on keyup and selects the appropriate radio button. I left out the styling for now but you should use a sprite for background images on the label and throw the radio buttons off the page.