How to select dynamically in Bootstrap-select with multiple values

jemz picture jemz · Sep 4, 2015 · Viewed 26.3k times · Source

How can I select dynamically in Bootstrap-select with multiple values, if my values are 1,3,4, using jQuery?

Here is my select:

Answer

David Stosik picture David Stosik · Sep 4, 2015

Use Bootstrap-Select's val method:

$('#myselect').selectpicker('val', [1,3,4]);

http://jsfiddle.net/a4bxnwws/

See Bootstrap-Select's documentation.