I'm attempting to create a textbox that will only accept contact numbers in the XXX-XXX-XXXX format, but I am having trouble achieving this. Can anyone provide guidance on how to implement a formatted contact number in typescript aurelia?
textbox.html
<input type="text" name.bind="name" class="form-control" placeholder.bind="placeholder" maxlength.bind="maxlength" onblur="addHyphen(f)"/>
textbox.ts
addHyphen(f){
f.value = f.value.slice(0,3)+"-"+f.value.slice(3,6)+"-"+f.value.slice(6,10);
}