'JQuery SSN Mask

How do I mask SSN in a Textbox and only show the last 4 digits of SSN when I load up a page using JQuery?



Solution 1:[1]

This is how you can mask your SSN Number using JS

.replace(/\D/g, '').replace(/^(\d{3})(\d{1,2})/, '$1-$2').replace(/^(\d{3})-(\d{2})(.+)/, '$1-$2-$3').substring(0, 11)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 jrswgtr