Eric
Eric

Reputation: 8088

show last four digits of SSN

I want to only show the last four digits of a Social security number after they leave the textbox. Does AJax have a tool for this that I am not aware of? How can i do this? I want to replace the digits with '*'. I'm working in .NET. Ajax is also accessible.

Upvotes: 0

Views: 2463

Answers (2)

Jeffrey Lott
Jeffrey Lott

Reputation: 7429

To my knowledge, there isn't a control that does this in the ASP.NET AJAX library, but the way we handle it is to use three text boxes separated by labels containing dashes. The first two are password boxes and the last one is a normal text box. It's kind of ghetto, but it works.

Upvotes: 3

Joel Coehoorn
Joel Coehoorn

Reputation: 416059

var el = document.getElementById('MyTextBoxId');
el.value = '***-**-' + (el.value.replace(/-/g,'') % 10000);

You probably also want a separate hidden input to save the original data...

Upvotes: 1

Related Questions