From the course: Building Great Forms with HTML and CSS

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Input mask

Input mask

From the course: Building Great Forms with HTML and CSS

Start my 1-month free trial

Input mask

- [Instructor] The next enhancement that we're going to add to the webpage is we're going to go ahead and make the webpage a little bit smarter. If we scroll down to the phone number area and I enter some numbers into the phone number area you can see that there is no formatting that is being applied to the numbers and I can enter as many numbers as I want. So if we're expecting the user to enter the numbers in this manner, with the parenthesis, a space, the three digits, a dash and then the remaining four digits and restrict their input so they only are allowed to put this many characters we need a little bit of help with some JavaScript. So that's what we're going to be doing now. I'll just jump into my code and we're not actually going to be changing anything in the HTML but I do want to scroll down and take you to the phone number area so I can point out a few things. Here's my input for the phone number. We have our type…

Contents