i.e. social security: XXX-XX-1234
@Html.Kendo().MaskedTextBox().Name(
"masked"
).Mask(
"~~~~-~~~-~~~~"
).Rules(x=> x.Add(
'~'
, y=>
"function(x){return !isNaN(x) || x === 'X'}"
))
<script>
$(
function
() {
$(
'#masked'
).on(
'blur'
,
function
() {
var
masked = $(
this
).data(
'kendoMaskedTextBox'
);
var
value = masked.raw();
if
(value) {
masked.oldValue = value;
masked.value(
"XXXXXXX"
+ value.slice(7,11))
}
})
$(
'#masked'
).on(
'focus'
,
function
() {
var
masked = $(
this
).data(
'kendoMaskedTextBox'
);
var
value = masked.oldValue;
if
(value) {
masked.value(value)
}
})
})
</script>