Skip to main content
deleted 90 characters in body
Source Link
j08691
  • 208.5k
  • 33
  • 269
  • 281

I am having troubles with the following problem. I essentially have three dropdown lists. When a selection is made from dropdown list 1, I want to remove that option from the other two. When dropdown list 1 changes it selection, add back the previous and remove the currently selected. This is the following code that I have. I feel I'm close, but still missing something essential.

Thanks in advance,

Roka

<script> $(document).ready(function () { $("#option1dropdown").change(function () { $("#option2dropdown").empty(); $("#option3dropdown").empty(); $("#option1dropdown option").each(function(){ if ($("#option1dropdown").val() != this) { $("#option2dropdown").append(this); $("#option3dropdown").append(this); } }); }); }); </script> 

I am having troubles with the following problem. I essentially have three dropdown lists. When a selection is made from dropdown list 1, I want to remove that option from the other two. When dropdown list 1 changes it selection, add back the previous and remove the currently selected. This is the following code that I have. I feel I'm close, but still missing something essential.

Thanks in advance,

Roka

<script> $(document).ready(function () { $("#option1dropdown").change(function () { $("#option2dropdown").empty(); $("#option3dropdown").empty(); $("#option1dropdown option").each(function(){ if ($("#option1dropdown").val() != this) { $("#option2dropdown").append(this); $("#option3dropdown").append(this); } }); }); }); </script> 

I have three dropdown lists. When a selection is made from dropdown list 1, I want to remove that option from the other two. When dropdown list 1 changes it selection, add back the previous and remove the currently selected. This is the following code that I have. I feel I'm close, but still missing something essential.

<script> $(document).ready(function () { $("#option1dropdown").change(function () { $("#option2dropdown").empty(); $("#option3dropdown").empty(); $("#option1dropdown option").each(function(){ if ($("#option1dropdown").val() != this) { $("#option2dropdown").append(this); $("#option3dropdown").append(this); } }); }); }); </script> 
Source Link
Roka
  • 526
  • 5
  • 25

Jquery add to dropdown list

I am having troubles with the following problem. I essentially have three dropdown lists. When a selection is made from dropdown list 1, I want to remove that option from the other two. When dropdown list 1 changes it selection, add back the previous and remove the currently selected. This is the following code that I have. I feel I'm close, but still missing something essential.

Thanks in advance,

Roka

<script> $(document).ready(function () { $("#option1dropdown").change(function () { $("#option2dropdown").empty(); $("#option3dropdown").empty(); $("#option1dropdown option").each(function(){ if ($("#option1dropdown").val() != this) { $("#option2dropdown").append(this); $("#option3dropdown").append(this); } }); }); }); </script>