Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Regular Expressions in JavaScript!
You have completed Regular Expressions in JavaScript!
Preview
Reformat the phone number users enter into the form. This will help them see at a glance whether they entered it correctly or not.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
If they see it in a format they expect,
0:00
it can help them know at
a glance if it's correct or not.
0:00
We want to do this reformatting when
the user is completely done typing.
0:04
The act the user takes when they're
satisfied with the form input
0:08
is to move focus away from the input.
0:12
The blur event occurs on an input
element when it loses focus.
0:15
Let's use the blur event on this
input to trigger our handler.
0:19
I'll add a handler to the telephone input
variable with addEventListener using
0:26
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up