<input-creditcard>
CreditCard component which format your number and show the type of card using Polymer.
Supported cards: American Express, Maestro, JCB, Master Card, Visa, Diners Club, Discover, Dankort, Laser, UnionPay
Example
Install
Install the component using Bower:
bower install polymer-input-creditcard --save
Or download as ZIP.
Usage
-
Import Web Components' polyfill:
<script src="bower_components/webcomponentsjs/webcomponents.min.js"></script>
-
Import Custom Element:
<link rel="import" href="bower_components/input-creditcard/input-creditcard.html">
-
Start using it!
<input-creditcard></input-creditcard>
Options
Attribute | Options | Default | Description |
---|---|---|---|
name |
string | none | Input name. |
value |
string | none | Input value. |
placeholder |
string | none | Input placeholder. |
disabled |
boolean | false | Disabled input. |
readonly |
boolean | false | Input is readonly. |
required |
boolean | false | Input is required. |
valid |
boolean | false | Validate credit card number. |
errorClassName |
string | error | Default validate error class |
Methods
Method | Parameters | Returns | Description |
---|---|---|---|
isValid() |
None. | boolean | Return true if credit card number is valid. |
getCardType() |
None. | string | Return type name of credit card. |
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
History
For detailed changelog, check Releases.