OtherOpt.js

A simple implementation of Other... values for select lists.
1.0, 2002-05-06

Usage

<select name="test" size="1" onchange="addOptionIfOther(this,'Enter value:')">
...
<option value="">Other...</option>
</select>

Functions

addOptionIfOther(this,prompt)

If the last option in the select list is chosen, the user is prompted for a new value, using the prompt supplied. The new option is inserted before the Other (last) option, and selected.

Setup

  1. Download otheropt.js to the web server (where browsers can access it).

  2. Add the following to the head of the pages that will use the validator:

    <script type="text/javascript" src="/path/otheropt.js"></script>