I have a kendo dropdownlist with values such as "Home","Work" etc and a kendomaskedtextbox. I want to mask the textbox at change event of the dropdownlist .Means if user selects home from dropdown the mask for the textbox will be 8(digits) and if personal then mask is 10(for digits).I want to do it at runtime with angular js. I have tried below code bt it didn't worked.
$scope.OnChange = function () {
var value = $("#Type option:selected").text();
alert(value);
if (value == "Home") {
$("#txtType").kendoMaskedTextBox({
mask: "$$$$$$$$",
rules: {
"$": /[0-9#]/
}
});
}
else {
$("#txtType").kendoMaskedTextBox({
mask: "$$$$$$$$$$",
rules: {
"$": /[0-9#]/
}
});
}
};
<select kendo-drop-down-list
k-data-source="Type"
k-data-text-field="'Name'"
k-data-value-field="'Id'"
ng-model="Type"
id="Type"
ng-change="OnChange()">
</select>
<input kendo-masked-text-box ng-model="Number" id="txtType"/>