Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select all options by default #785

Closed
psyclight opened this issue Aug 21, 2016 · 4 comments
Closed

Select all options by default #785

psyclight opened this issue Aug 21, 2016 · 4 comments
Labels

Comments

@psyclight
Copy link

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!

@psyclight
Copy link
Author

psyclight commented Aug 21, 2016

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

@davidstutz
Copy link
Owner

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

@sanjoyroy
Copy link

thanks psyclight! that worked!

@WeiB71
Copy link

WeiB71 commented Oct 24, 2018

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

this was great it works on me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants