I was wondering if someone got an idea how to remove a choice you made in multiple dropdown menus.
I have no idea if you can do it with dropdown menu's maybe I need datalist or something else.
But what I mean is I have for example 6 dropdown menu's like this dropdown menu's
I made it so you have 1 - 6 but if I choose number 3 in the first one, how can I remove it in the 2nd menu, or make in invisible.
I had this problem in multiple projects from me but never know how to solve it.
Code of 1 of the menu's
<select name="getal" form="enquete" />
<?php
for($i=1; $i<=5; $i++)
{
echo "<option value=".$i.">".$i."</option>";
}
?>
</select>
Let´s say you got 2 option select items like this:
You can add 2 jquery selectors - they can be dynamic - I´m showing you how to do it with 2 dropdown lists:
Create a function to react on change of dropdown 1 (again, you can do it on each beside the clicked one):
We are just removing the options, if you want you can re-add them when changed again. Create one array and iterate through the options, if not present, append the missing options.
Is this what you want to do?