How to remove options from select element using jquery?

Posted by Lapa on Stack Overflow See other posts from Stack Overflow or by Lapa
Published on 2010-04-02T12:02:09Z Indexed on 2010/04/02 12:03 UTC
Read the original article Hit count: 187

Filed under:
|
|

I have n drop-downs like this:

<select id="select1">
  <option>1</option>
  <option>2</option>
  <option>3</option>
</select>

<select id="select2">
 <option>1</option>
 <option>2</option>
 <option>3</option>
</select>

with identical options. All the choices should be unique, so once the option is selected in one combobox, it should be removed from others.

Now, http://stackoverflow.com/questions/877328/jquery-disable-select-options-based-on-radio-selected-need-support-for-all-brows offers a nice solution, but how can I modify this to work with selects instead of radio buttons?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery