How to hide items under the options from one select box upon selection of an item in another select

Posted by jl on Stack Overflow See other posts from Stack Overflow or by jl
Published on 2010-05-20T02:50:46Z Indexed on 2010/05/20 3:00 UTC
Read the original article Hit count: 396

Filed under:
|

Hi,

I am new to jQuery and would like to know how is it possible for me to hide an option in a selection box based on the selection of another selection box.

I have 5 selection boxes, this is for the administrator to select the users of a limited criteria. The <options> are create dynamically from the results of a database query and php, and they all have the same <options>.

e.g. this is an example of the selection boxes with their option values.

userbox1 - Amy, Bosh, Cathy, Daniel, Ethan
userbox2 - Amy, Bosh, Cathy, Daniel, Ethan
userbox3 - Amy, Bosh, Cathy, Daniel, Ethan
userbox4 - Amy, Bosh, Cathy, Daniel, Ethan
userbox5 - Amy, Bosh, Cathy, Daniel, Ethan

So if the administrator selects Cathy in userbox1, Cathy will be automatically be hidden from the selection on the rest of the userbox. And if the administrator changes his/her mind and reselect another user call Ethan. The userboxes should be able to show the availability of Cathy in the selection.

I am not sure is hide/show the correct status to be used in such cases. May I know how is it possible to write the function as stated above? If I am missing some current references, kindly point me to it. Thanks in advance.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript