Expiry & CVC Mask
Expiry (MM/YY) and CVC inputs with masks, via Cleave.js.
Requires Bootstrap 5, Cleave.js. Add the CDN tags below to your page (styles in
<head>, scripts before </body>). The downloaded file already includes them.<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"><script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script><script src="https://cdn.jsdelivr.net/npm/cleave.js@1.6.0/dist/cleave.min.js"></script><div class="card border-0 shadow-sm" style="max-width:300px"><div class="card-body"><div class="row g-2"><div class="col-7"><label class="form-label small fw-semibold">Expiry</label><input class="form-control" id="clExp" placeholder="MM/YY"></div><div class="col-5"><label class="form-label small fw-semibold">CVC</label><input class="form-control" id="clCvc" placeholder="123"></div></div></div></div>new Cleave('#clExp',{date:true,datePattern:['m','y']});
new Cleave('#clCvc',{numeral:true,numeralIntegerScale:4});Free to use.This component uses Bootstrap 5, Cleave.js (linked above). Copy any file, or download a ready-to-open .html page with the CDN links already included.