title: Jquery dynamically update "other" option in select
body: <p>I'm working on a project that will be using a lot of select menus to enter various data. I'd like to include an 'other' option directly in the select that will trigger a simple dialog and allow users to enter a custom value (where appropriate) similar to the following javascript code:</p>
  
  <pre><code>&lt;script type="text/javascript" language="javascript"&gt;
      function chkother(fld,len,idx) {
          if ((idx+1)==len) {
              other=prompt("Please indicate 'other' value:");
              fld.options[idx].value=other;
              fld.options[idx].text=other;
          }
      }
  &lt;/script&gt; 
  </code></pre>
  
  <p>which works with a select:</p>
  
  <pre><code>&lt;select onchange="chkother(this,this.options.length,this.options.selectedIndex)" name="example" id="example" class="formSelect"&gt;
  &lt;option  value=""&gt;&lt;/option&gt;
  &lt;option  value="yes"&gt;yes&lt;/option&gt;
  &lt;option  value="no"&gt;no&lt;/option&gt;
  &lt;option  value="other"&gt;other&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>And brings up a prompt that will update the option with the users text.</p>
  
  <p>I'd like to do something similar using jquery so I can look at extending the functionality and learning a bit of jquery, but I'm having trouble getting started.</p>