Godbrand0
@Godbrand0All solutions
- Submitted 5 months ago
interactive card details using tailwindCSS and javascript
- HTML
- CSS
- JS
function formatCardNumber(value) { const formattedValue = value.replace(/(.{4})/g, "$1 "); return formattedValue.trim(); } function changeNumber() { const formattedNumber = formatCardNumber(cardNumber.value); cardNumber.value = formattedNumber;
if ( formattedNumber.replace(/\s/g, "") !== "" && !alphabet.test(cardNumber.value) ) {