Javascript Validation Examples

Working with strings

  1. Check if a character string is a number
  2. Check if a number is positive
  3. Check the length of a string, and other String methods

Numbers

  1. Format a number

Form Input Fields

  1. Using alert() to check data passed to function
  2. Validate a single field onChange
  3. Validate a single field onSubmit
  4. Validate a form onSubmit
  5. Validate fields by name
  6. Validate a form onSubmit with Regular Expressions