Skip to content
Advertisement

Bootstrap multiselect select all options at instanciation

I am using bootstrap multiselect plugin to add dynamically code into an select. Here is my code:

Html:

JavaScript

Javascript

JavaScript

When the multiple select is instancied, it appears as such in the browser (there is some css formatting explaining its aspect):

enter image description here

Whereas I would like it to appear as (with all checkbox selected at instanciation, without to click on ‘select all’):

enter image description here

I looked into the doc, but did not find it …

Bootstrap multiple select documentation

Advertisement

Answer

You need to run both selectAll (with false as second parameter – this indicate that all values will be selected, even non-visible values) and updateButtonText (to change the text that appear in the drop-down menu).

Check this example:

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement