COSC 219 · JavaScript Form Validation

Three Types of Form Validation

Test the three examples below. Each shows a different way to check user input.

1. JavaScript Alert Box

Leave the name empty, then click Submit to see an alert box.

2. JavaScript Numeric Validation

Please input a number between 1 and 10. Try 12 to see “Input not valid” below the field.

3. HTML Built-in Email Validation

Type deb, then click Submit. The browser will display its built-in email validation callout.

The exact browser message varies by Chrome, Firefox, Safari, etc.