Credit Card Validator In Vanilla JavaScript

Category: Form , Javascript | August 22, 2017
Views Total:4,020 views
Official Page:Go to website
Last Update:August 22, 2017


Credit Card Validator In Vanilla JavaScript


A vanilla JavaScript credit card validator that detects the card type and limits the length of credit card numbers.

How to use it:

Load the necessary VanillaMasker library in the html document.

<script src=""></script>

Load the vanilla card validator:

<script src="assets/cardValidator.bundle.js"></script>

Create the credit card input.

  <div name="card-container">
      <input type="text" id="card" maxlength="16" />
      <label class="card-label" for="">Credit Card</label>
      <div id="logo"></div>

You Might Be Interested In:

Leave a Reply