creditable
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -19,6 +19,8 @@ // Input a credit card number string, returns a key signifying the type of credit card it is | ||
var maxlen = self.getMaxlength(); | ||
self.$el.attr({ | ||
maxlength: maxlen, | ||
placeholder: self.getPlaceholder( maxlen ) | ||
}); | ||
if( maxlen ) { | ||
self.$el.attr( "maxlength", maxlen ); | ||
} else { | ||
self.$el.removeAttr( "maxlength" ); | ||
} | ||
self.$el.attr( "placeholder", self.getPlaceholder( maxlen || 4 ) ); | ||
}); | ||
@@ -32,3 +34,4 @@ } | ||
CreditableSecurityCode.prototype.getPlaceholder = function( maxlen ) { | ||
return ( new Array( maxlen || this.getMaxlength() ) ).join( "0" ) + "0"; | ||
var len = maxlen || this.getMaxlength() || 4; | ||
return ( new Array( len ) ).join( "0" ) + "0"; | ||
}; | ||
@@ -35,0 +38,0 @@ |
{ | ||
"name": "creditable", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Utilities for working with credit card form input.", | ||
@@ -5,0 +5,0 @@ "main": "creditablecardtype.js", |
@@ -18,2 +18,19 @@ # creditable | ||
// returns "AMEX"; | ||
``` | ||
``` | ||
## CreditableSecurityCode | ||
Update the Security Code placeholder and maxlength based on the card type of the number entered into the Credit Card field. 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> | ||
``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5046
62
36