Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.

Latest commit

 

History

History
41 lines (30 loc) · 1.06 KB

README.md

File metadata and controls

41 lines (30 loc) · 1.06 KB

⚠️ This project is archived and the repository is no longer maintained.

creditable

npm version Build Status

Utilities for working with credit card form input.

CreditableCardType

CreditableCardType( "4123 1234 1234 1234" );
// returns "VISA";

CreditableCardType( "5123 1234 1234 1234" );
// returns "MASTERCARD";

CreditableCardType( "6011 1234 1234 1234" );
// returns "DISCOVER";

CreditableCardType( "3412 123456 12345" );
// returns "AMEX";

CreditableSecurityCode

Update the Security Code placeholder and maxlength based on the card type of the number entered into the Credit Card field. Supports one pair of fields per form. Full demo in index.html.

<form>
	<label>
		Credit Card Number
		<input type="text" data-creditable-creditcard>
	</label>
	<label>
		Security Code
		<input type="text" data-creditable-securitycode>
	</label>
</form>