badwolfff
asked on
How do I handle multiple selects in jQuery?
I have written a piece of code that synchronizes two select dropdowns. If I choose value one in one select then the same value gets selected in the other select.
https://jsfiddle.net/lupoc atttivo/q9 tpLxw8/
However, what I would like to do is the exact opposite. If I choose value one in select 1, then in select 2 it should choose value 2. And vice versa.
could anyone please help?
thanks
https://jsfiddle.net/lupoc
However, what I would like to do is the exact opposite. If I choose value one in select 1, then in select 2 it should choose value 2. And vice versa.
could anyone please help?
thanks
ASKER
Hi,
thanks for the answer. I already knew this method but the problem is that I can't specify the values beforehand as they are assigned. All I know is that when value 1 of dropdown 1 is chosen, then value 2 of dropdown 2 should become selected. And vice versa. Is it possible without using this trick? All we know is that the number of options per dropdown is always 2.
thanks
thanks for the answer. I already knew this method but the problem is that I can't specify the values beforehand as they are assigned. All I know is that when value 1 of dropdown 1 is chosen, then value 2 of dropdown 2 should become selected. And vice versa. Is it possible without using this trick? All we know is that the number of options per dropdown is always 2.
thanks
There needs to be a value to compare or you can compare it using the selectedIndex property of the select
ASKER
"or you can compare it using the selectedIndex property of the select "
could you please explain with an example?
could you please explain with an example?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window
Open in new window