I am working on a site (that needs to work both regular browsers and on tablets and phones) that uses input fields for phone and zipcode entry.
We'd like to ensure that the data in these fields have proper formatting. The most common mechanism I've seen for that is jquery.mask - but that pre-fills the text box with fixed mask characters, and TPTB have decided that is ugly. (And I generally agree with them).
I've seen, on a few websites, phone number fields in which the formatting characters are added one-at-a-time, as the data is typed.
That is, I starting with an empty field...
- I type "8" and I see "(8"
- I type "0" and I see "(80"
- I type "0" and I see "(800)"
- I type "5" and I see "(800)5"
- I type "5" and I see "(800)55"
- I type "5" and I see "(800)555-"
- I type "1" and I see "(800)555-1"
- I type "2" and I see "(800)555-12"
- I type "1" and I see "(800)555-121"
- I type "2" and I see "(800)555-1212"
IOW, the formatting characters are added, one at a time, as I type characters into the field.
Does anyone know of a plugin that implements this behavior?
I'm working in ASP.NET MVC4, with Bootstrap 3, for what it is worth.