So I have the following input:
<input type='text' placeholder='Phone number'>
Simple as can be. What I want is that whenever that specific box is focused, a pre-determined pattern will show up to assist the user on how exactly will that box accept the data. The way I want it to display is like this:
(__)____-____
So when the user has typed any 7 initial numbers, it'd display like this:
(21)3322-1___
without the user needing to type "(", ")", or "-", since that would already be in the correct spot while the user is typing the number.
After the box has accepted 10 digits (two in the beginning, then four - four), the input box will stop receiving any type of data (that could be done with maxlength='10', so not an issue). If no data is in the box, it'd go back to display the regular placeholder of the html file:
Phone number
I'd be glad if anyone teach me how to do this. Thanks in advance to anyone that's willing to help.