I want to filter the list of options based on the selection of another drop down.
Please see the jquery code below; i am sure there is a tiny bit that i am missing t
You could do it this way:
$(document).ready(function () {
$('#selectcat').change(function () {
$('#selectprod option').show();
if ($('option:selected', this).attr('id') == 'selectionone') {
$('#selectprod option.edibles').hide();
}
if ($('option:selected', this).attr('id') == 'selectiontwo') {
$('#selectprod option.vegfats').hide();
}
});
});
jsFiddle example
As this may not work in older versions of IE, you can replace $('#selectprod option').show(); with $('#selectprod option').prop('disabled',false); and $('#selectprod option.vegfats').hide(); with $('#selectprod option.vegfats').prop('disabled',true);