APPROVED ANSWER
SELECTED ANSWER
replied on March 17, 2014
•
Show version history
It's a problem with your code. You need to handle the case where the value is blank when the user leaves the field, and you also want to make sure that, if the user leaves the field twice, their social will not be replaced by ***-**-****.
Try something like this:
$(document).ready(function () {
$.getScript('http://formsServer/Forms/js/jquery.mask.min.js', function () {
$(".ssn input").mask("999-99-9999");
$(".ssn input").blur(function () {
if ($(this).val() == '***-**-****') { return; }
$(".filledField input").val($(this).val());
if ($(this).val() == '') { return; }
else if (/\d\d\d-\d\d-\d\d\d\d/.test($(this).val())) {
$(this).val('***-**-****');
}
});
});
});