Problem
I need to format an input field visually in order to help the user know what they should type as a phone number. For example, I want to accept a phone number as being a 3 digit area code, 3 digit prefix and 4 digit suffix: (207) 555-1212. I want to:
What's the best way to do it?
Note: This is not for displaying of a number -- I could use a filter for that. This is for formatting data within an input
field.
Thanks for your help!
If you are looking for a simple solution, you could give AngularUI a try, http://angular-ui.github.com/
This is the example from the "Mask" section of that page:
<input ng-model="maskDemo" ui-mask="'99-99-9999'">
The "9"'s are numbers, and other stuff is just a mask / placeholders. It should only submit the actual values. You would edit the mask to include parentheses and anything else you may need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With