I have a selectbox with a set of multiple attributes. I also use <optgroup> tags to separate categories in my selection box. I am looking for a way using javascript or jQuery so that the various parameters within each group are led with "switch logic" and not with "check logic". For example:
<optgroup label="cat1"> <option>item 1.1</option> <option>item 1.2</option> </optgroup> <optgroup label="cat2"> <option>item 2.1</option> <option>item 2.2</option> </optgroup>
- The user selects
item 1.1 in the list. item 1.1 is selected as expected. - The user selects
item 2.1 in the list. Now select both item 1.1 and item 2.1 . - The user selects
item 1.2 in the list. Now item 1.1 is canceled, and item 2.1 and item 1.2 are selected.
It makes sense? Thanks in advance!
mbeasley
source share