I have a grid in which there is a textbox that is currently accepting numeric numbers. However I want to apply masking in that textbox using javascript or jquery without any plugin. I have searched and everywhere they are asking for plug-in.
I tried this solution but it does not work my default value should be 00000-00-000
$("input[name='masknumber']").on("keyup change", function(){
this.value = createMask($("input[name='masknumber']").val());
})
function createMask(string){
return string.replace(/(\d{2})(\d{3})(\d{2})/,"$1-$2-$3");
}
Any help would be appreciated.