Fork me on GitHub

jquery-ccmask

(This example won't work in IE8 due to using jQuery 2.1.11 but should work with an older version of jQuery with the migrate package)

Code
<input class="form-control" type="text" id="onblur" name="onblur" placeholder="Masked Credit Card" data-blur-credit-card autocomplete="off">
<input class="form-control" type="text" id="onkeyup" name="onkeyup" placeholder="Masked Credit Card on" data-keyup-credit-card autocomplete="off">
<script>
$("input[data-blur-credit-card]").ccmask();
$("input[data-keyup-credit-card]").ccmask({keyup: true});
</script>