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

Jquery add to dropdown list

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> 
Roka
  • 526
  • 5
  • 25