javascript - Filter three select boxes based on previous selections -


i trying change select boxes in order based on selected. have working first 1 change not third. if can me make third 1 work great.

http://jsfiddle.net/ze5aa/21/

here js using:

$("#cat_custom_496270").change(function() {      if($(this).data('options') == undefined){         $(this).data('options',$('#cat_custom_495029 option').clone());     }       var id = $(this).val();     var options = $(this).data('options').filter('[value*=' + id + ']');     $('#cat_custom_495029').html(options); });  $("#cat_custom_495029").change(function() {      if($(this).data('options') == undefined){         $(this).data('options',$('#cat_custom_495038 option').clone());     }      var id = $(this).val();     var options = $(this).data('options').filter('[value*=' + id + ']');     $('#cat_custom_495038').html(options); }); 

wrap value attribute filter's value in quotes, since there space in values.

var options = $(this).data('options').filter('[value*="' + id + '"]'); 

fiddle


Comments