I found a pretty old example but it's almost doing exactly what i need to do: Auto Dash using Javascript on FOCUS (for a telephone number format)
However instead of the current format xxx-xxx-xxxx i'd like to do (xxx) xxx-xxxx
Can someone give me a hand with the script below with this??
$('.telnumber').keyup(function() {
this.value = this.value
.match(/\d*/g).join('')
.match(/(\d{0,3})(\d{0,3})(\d{0,4})/).slice(1).join('-')
.replace(/-*$/g, '');
console.log("this value", this.value);
});