Search code examples
jquerycsstwitter-bootstrapmulti-selectbootstrap-multiselect

Bootstrap multiselect plugin not working dropdownlist not showing


I am using bootstrap 2.3.2 with the multiselect plugin. I have the multiselect dropdown in a modal

multiselect is initiallized like:

$('.multiselect').multiselect({
    includeSelectAllOption: true,
    maxHeight: 150,
    buttonWidth: 250, 
});

The first time round when the modal is first loaded it works fine - I can select the options from the dropdownlist. But when I close the modal (pressing the search submit button) I deselect all the options in the dropdown like this:

$('.multiselect').multiselect('deselect', $('.multiselect').val());

The problem is when I open the modal the second time the button is visible but no dropdownlist, i have tried to replace above with multiselect.refresh & multiselect.rebuild. It seems a css issue or something.


Solution

  • According to the exemple http://davidstutz.github.io/bootstrap-multiselect/ you could deselect options using :

    $('option').each(function(element) {
        $(this).removeAttr('selected').prop('selected', false);
    });
    

    I Hope it may help you.