In the United States, a Social Security number (SSN) is a nine-digit number issued to U.S. citizens, permanent residents, and temporary working (Some Visa holders) to track individuals for social security purposes and also used as national identification number by financial institutions to authenticate a person to setup bank accounts, credit cards , loans and tax filing.
The SSN is frequently used by those involved in identity theft, because people asking for treat it as an authentication. If some one know about SSN, current address , zip code etc. generally fraud person can retrieve other detail from financial institutions to make financial losses.
Tips to protect you from becoming a victim of identity theft
- Don’t carry your Social Security card or any documents that include your Social Security number (SSN) or Individual Taxpayer Identification Number (ITIN).
- Don’t give a business your SSN or ITIN just because they ask. Give it only when required
- Protect your financial information.
- Check your credit report every 12 months.
- Review your Social Security Administration earnings statement annually.
- Secure personal information in your home.
- Protect your personal computers by using firewalls and anti-spam/virus software, updating security patches and changing passwords for Internet accounts.
- Don’t give personal information over the phone, through the mail or on the Internet unless you have initiated the contact or you are sure you know who you are dealing with.
Here, you will know about mask SSN on web page so that can’t see by fraud person there other cases also where sensitive information need to mask by organization for come over from privacy violation.
See Also :
- Log4j2: How to Mask Logs Personal/Confidential/SPI Information
- How to Mask JSON Confidential/Personal Information in logs :JAVA
- How to mask JAVA Object confidential/personal information in logs while Printing
- How to MASK XML Confidential/Personal Data : JAVA
- How to mask Personal/Confidential Information on web page
SSN Masking Example:
Here considering, SSN of length 9 digits. By masking will hide initial 5 digits and show only last 4 digits. For example, SSN is 123456789 than after mask will display as XXX-XX-6789.
![]() | ![]() |
HTML Changes
Create a text box on your page as in attachment in download section.
Java Script/JQuery Changes
Copy below java script in your head section of page.
var originalVal;
$(document).ready(function()
{
if($('#txtSSN').val().length>0)
{
if($('#txtSSN').val().indexOf("X")==-1)
{
originalVal=$('#txtSSN').val();
}
maskSSN(this);
}
$('#txtSSN').blur( function(e)
{
if($('#txtSSN').val().indexOf("X")==-1)
{
originalVal=$('#txtSSN').val();
}
maskSSN(this);
});
$('#txtSSN').focus( function(e)
{
$(this).val(originalVal);
});
});
function maskSSN(regularSSN)
{
var varlen =$(regularSSN).val().length;
if(varlen > 9)
{
$("#error").text('Not Valid SSN.');
}
else
{
$("#error").text('');
var str = $(regularSSN).val();
var mask = varlen > 0 ? varlen > 1 ? varlen > 2 ? varlen > 3 ? varlen > 4 ?
'XXX-XX-'
: 'XXX-X'
: 'XXX-'
: 'XX'
: 'X'
: '';
if (varlen < 4) {
$(regularSSN).val(mask);
} else {
$(regularSSN).val(mask + $(regularSSN).val().substring(5));
}
}
}
Note :
This masking example is created considering standard length of text size and formatting of text field, that can vary according to organizations. If your organizations having different format and text size modify source code according to your need.
If you are facing any issue drop a comments will try to connect as soon as possible.
Download Source code
To download the source code of this example, click on below given download link. Mask SSN
References
- https://www.irs.gov/newsroom/identity-theft-information-for-taxpayers-and-victims
- https://en.wikipedia.org/wiki/Individual_Taxpayer_Identification_Number
- https://www.tomsguide.com/us/what-to-do-ssn-stolen,news-18742.html
Related Posts
Your Feedback Motivate Us
If our FacingIssuesOnIT Experts solutions guide you to resolve your issues and improve your knowledge. Please share your comments, like and subscribe to get notifications for our posts.
Happy Learning !!!
You must log in to post a comment.