nobleclem/jQuery-MultiSelect

'reload' not working on disabled + hidden options

Closed this issue · 1 comments

ack-s commented

Hi,

multiselect is working fine (using the latest version 2.4.19). Depending on a checkbox value I´m trying to hide / show some select options using:

$('my Selector').prop('disabled', true);
$('my Selector').hide();

Options of the original select field are correctly modified to 'style="display: none;" disabled="" ' (and back if checking the checkbox), but the multiselect element remains unchanged, even if I use multiselect('reload').

Did I miss something?

Thank you!

-Ack-s-

So by default the plugin doesn't recognize any attributes in the select list. So what you need to do is explicitly add the disabled attribute to be passed along to the multiselect list.

$('select[multiple]').multiselect({
    optionAttributes: [ 'disabled' ]
});