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