I am using jquery.card.js from jessepollak. This is amazing.
If anyone has experience, could you tell me if it is possible to choose which types of credit card you want to support?
eg.
var card = new Card({
supportedCardTypes: 'Visa, Master';
});
Are there any such options? How do I achieve this?
Thank.
Answer ------------------------------------------- ------ -----------
It turns out that only changing the types of cards proposed by TMan does not work. But this is not about fish, but about giving me the idea of fishing. After hacking the TMan idea in a script, I found that adding this line would work:
Card.prototype.handlers = {
setCardType: function($el, e) {
var cardType = e.data === 'mastercard' || e.data === 'visa' ? e.data : 'unknown';
if (!QJ.hasClass(this.$card, cardType)) {
QJ.removeClass(this.$card, 'jp-card-unknown');
QJ.removeClass(this.$card, this.cardTypes.join(' '));
QJ.addClass(this.$card, "jp-card-" + cardType);
QJ.toggleClass(this.$card, 'jp-card-identified', cardType !== 'unknown');
return this.cardType = cardType;
}
},
You can just hack into the library source code, quickly and dirty, NOT a good idea, or do something to initialize the handlers in your own way in your own code.
.