Chapter 8: Forms and Regular Expressions

Return to Chapter 8

 

To use this script on your own page, click in the text area below, select all, and copy to grab the script. Then, just paste into your own page — and you're done.

Formatting and Validating Strings

See it run: Formatting and Validating Strings

Script 8.7

This JavaScript validates and formats a user-entered phone number.