How to validate radio buttons with JavaScript

A friend recently asked for a code sample showing JavaScript being used to client-side validate the radio inputs of an HTML form. This example took about 15 minutes to build and tweak to her specifications. The techniques used here are very rudimentary, but effective nonetheless. If you have suggestions for other approaches, or additional questions related to this example, be sure to email me. Best wishes!

For more information, you'll want to keep a good javascript reference manual handy.

Choose "3" 1 2 3 4

Choose "2" 1 2 3 4

Keywords: JavaScript client-side validation radio inputs radio buttons HTML form