Skip to main content
3 of 3
deleted 4 characters in body
Nicola Peluchetti
  • 77k
  • 32
  • 150
  • 197

You could use nextUntil() and do like this:

var allOptions = $("#input_13 option"); jQuery('#input_1_34').bind('change', function() { //get selected value from drop down var selectedValue = jQuery("#input_1_34").val(); $('#input_13').html('').append(allOptions); selectedOptions = $("#input_13 option[value=" + selectedValue + "]").nextUntil('.level-0').andSelf(); $('#input_13').html('').append(selectedOptions); }); 

EDIT- i changed the answer to allow the user to choose more options

Look at the fiddle here: http://jsfiddle.net/QGCh4/2/

Nicola Peluchetti
  • 77k
  • 32
  • 150
  • 197