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
This is a simple approach to the issue, which should be rather solid:
css:
.hiddenOptions > select
{
display: none;
}
.hiddenOptions > select.active
{
display: inline-block;
}
JS:
$('.masterSelect').on('change', function() {
$('.hiddenOptions select').removeClass("active");
$('.hiddenOptions select').eq($(this).val()).addClass("active");
showValue();
});
$('.hiddenOptions select').on('change', function() {
showValue();
});
$('.masterSelect').trigger('change'); //set initial value on load
function showValue()
{
console.log($('.hiddenOptions select.active').val());
}
https://jsfiddle.net/g5h2k6t4/1/