I\'m using the Bootstrap-Select plugin like this:
HTML:
$('.selectpicker').selectpicker("val", "value");
Also, you can just call this for multi-value
$(<your select picker>).selectpicker("val", ["value1", "value2"])
You can find more here https://developer.snapappointments.com/bootstrap-select/methods/
You can set the selected value by calling the val method on the element.
$('.selectpicker').selectpicker('val', 'Mustard');
$('.selectpicker').selectpicker('val', ['Mustard','Relish']);
This will select all items in a multi-select.
$('.selectpicker').selectpicker('selectAll');
details are available on site : https://silviomoreto.github.io/bootstrap-select/methods/
$('selector').selectpicker('val',value);
in place of selector you can give you selector either class or id for example: $('#mySelect').selectpicker('val',your_value)
$('.selectpicker').selectpicker('val', '0');
With the '0' being the value of the item you want selected
Actually your value is set, but your selectpicker is not refreshed
As you can read from documentation
https://silviomoreto.github.io/bootstrap-select/methods/#selectpickerval
The right way to do this would be
$('.selectpicker').selectpicker('val', 1);
For multiple values you can add array of values
$('.selectpicker').selectpicker('val', [1 , 2]);