fixed the fucking SSN LETS GOOOOO!!!!
This commit is contained in:
parent
796bb09b38
commit
d5e588a0fe
|
@ -120,7 +120,24 @@
|
|||
|
||||
|
||||
<%# This is for Social Security formatting and # of digits %>
|
||||
|
||||
<%# This is for Social Security formatting and # of digits %>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const ssnField = document.getElementById('ssn-field');
|
||||
|
||||
ssnField.addEventListener('input', () => {
|
||||
let ssn = ssnField.value.split('-').join(''); // Remove dashes
|
||||
ssn = ssn.replace(/\D/g, ''); // Keep numbers only
|
||||
|
||||
if (ssn.length > 3 && ssn.length <= 5) {
|
||||
ssn = ssn.slice(0, 3) + '-' + ssn.slice(3);
|
||||
} else if (ssn.length > 5) {
|
||||
ssn = ssn.slice(0, 3) + '-' + ssn.slice(3, 5) + '-' + ssn.slice(5, 9);
|
||||
}
|
||||
ssnField.value = ssn; // Update the field value
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue