Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save yahelc/735483 to your computer and use it in GitHub Desktop.
Save yahelc/735483 to your computer and use it in GitHub Desktop.
jQuery('#cc_number').bind('keypress, keyup', function(){
var first = parseInt(jQuery(this).val().charAt(0), 10);
if(first==3) //amex
{
jQuery('#cc_ax').attr('checked', 'checked');
}
else if(first == 4) //visa
{
jQuery('#cc_vs').attr('checked', 'checked');
}
else if(first == 5) //MC
{
jQuery('#cc_mc').attr('checked', 'checked');
}
else if(first == 6) //Discover
{
jQuery('#cc_ds').attr('checked', 'checked');
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment