Bootstrap-multiselect: Select all options by default

Created on 21 Aug 2016  路  4Comments  路  Source: davidstutz/bootstrap-multiselect

What can I do to make all options have been already selected when page loaded. I have tried a few times,but failed, thank you so much!

question

Most helpful comment

$('#id option').each(function(){
this.selected=true;
});
$('#id').multiselect("refresh");
I used this method finally.

All 4 comments

$('#id option').each(function(){
this.selected=true;
});
$('#id').multiselect("refresh");
I used this method finally.

Use the selectAll method or just generate the select element with pre-selected options.

thanks psyclight! that worked!

$('#id option').each(function(){
this.selected=true;
});
$('#id').multiselect("refresh");
I used this method finally.

this was great it works on me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

donbonifacio picture donbonifacio  路  7Comments

rodrigonunes100 picture rodrigonunes100  路  3Comments

SaeedSoltoon picture SaeedSoltoon  路  3Comments

naxxateux picture naxxateux  路  5Comments

mirroras picture mirroras  路  3Comments