stripe-archive / jquery.payment

[DEPRECATED] A general purpose library for building credit card forms, validating inputs and formatting numbers.
MIT License
3.53k stars 686 forks source link

Get input class on pre-filled field #262

Closed nikhil-toobler closed 7 years ago

nikhil-toobler commented 7 years ago

How I get input class [card type class name] on prefilled field. Check below codes

<input class="text-field cc-number-saved" type="tel" autocomplete="off" value="5252-5555-5555-5555">

Here I give card number as value. But on load, the input doesn't take the class name as card name and when change the value on input focusing the input field has triggered corresponding class name. I have fixed the issue with some custom codes that given below;

//get card type on load
$('.cc-number-saved').each(function() {
       var cardType = $.payment.cardType($(this).val());
       $(this).addClass(cardType);
});

Any other solution to get input class name on page load?

jenan-stripe commented 7 years ago

Hi @nikhil-toobler -- please see https://github.com/stripe/jquery.payment/issues/117#issuecomment-172288186