javascript - Update the selected value of a dropdown based on the selected value of others -


I have loads of dropdowns on the page (up to 1000), like this:

< Code> & lt; Choose Name = "Select"> Php Print (Select $);? & Gt; " Id = "select

So everyone gets a name and id selectX, where x is the number between 1 and 1000.

There are values ​​in each -









When the page loads, each Set on -

Each time selects a value (except -) I need to make sure that it has not already been selected if it is so that all other dropdowns with that value Need to set back -

For example, for example
Dropdown is set to 1 -
Dropdown is set to 2 -
Dropdown is set to 3 -
Drop Aun is set at 4 -

Sets a user-selected drop down 2 to 4 ''.

This means that we now have the value:
dropdown set to 1 -
Dropdown 2 is set to 4 - Dropdown is set to 3 -
Dropdown is set to 4 -

User then sets the value of '5' from dropdown 3 and 5 is not set anywhere so it works.

This means that now we have the values:
Dropdown is set to 1 -
Dropdown 2 is set to 4 - Dropdown 3 set is below 5 - On dropdown 4 Is set -

The user then sets the value of drop down from 1 to 4. 4 is already in use by the dropdown 2, so dropdown 2 has been set back -

This means we now have the values:
Dropdown 1 is set to 4 - Dropdown set to 2 - The
dropdown is set to 3 - Dropdown is set to 4 -

I hope this makes sense? The number of dropdowns and their names depends on different user settings, so it can be anywhere from 10 - 1000.

Can anyone help?

You may be interested in giving the name "select_name []", which is the server side < Strong> Very easy to process PHP, and valid on the customer side is your friends.

You can select the dropdown in their name (if you have worked for the first time, and gave them all the same name), alternatively, you can name them for a single category And they can catch them from the class by checking the event of change of each element in this array of dropdowns that the value is selected (to loop through the array of dropdown only above), and to reset them With whom The struggle is going on.

The main point here is array, array, array.

Why do you have 1,000 dropdowns?
Are you deliberately humiliating your user base?

Comments