Click here to Skip to main content
15,897,718 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
My Requirement:

1. When user type in SSN text box it should look like this : 111-11-1111 - Which I have achieved.

2. On Textbox blur event I want that text to be converted to "***-**-1111, when I am assigning a new value to it,I am getting undefined value in it.

I will really appreciate if anybody will help me achieve this. The JavaScript code I have written :

var ssnValue = document.getElementById(<%=txtSSN.ClientID%>).value;

var lastfour = ssnValue.substring(7, 11);

1. var uSsn = "*****" + lastfour; Or
2. var uSsn = "***-**-" + lastfour;

Things Tried :
1. ssnValue.value = uSsn ;
2. ssnValue = uSsn .value;
3. ssnValue.value = uSsn .value;
4. ssnValue = uSsn ;
Posted
Updated 29-May-12 6:46am
v2

1 solution

you can store the value of textbox in a hidden variable & assign the new value to textbox
 
Share this answer
 
Comments
Shweta Mogadpally 29-May-12 13:53pm    
I am already storing that SSN value in hidden textbox, My concern is to assign the "USsn" value to "txtSSN"(Is masked-edit textbox),The new value is not getting displayed into it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900