Hi All.
How can i set default value of bootstrap-select?
for example i have a list of selection : apple, mango, orange, pineaple.
And i want to set default value of the selection is apple.
is there a way to do that?
$('.selectpicker').selectpicker('val', 'Mustard');
$('.selectpicker').selectpicker('val', ['Mustard','Relish']);
http://silviomoreto.github.io/bootstrap-select/methods/#selectpickerval
Mine also was not working, but I put $ ('selectpicker'). Selectpicker ('val', 'Mustard'); below the input select and worked
Is there a way to use $('.selectpicker').selectpicker('val', x) without triggering the changed.bs.select event?
@LouisBellinger
$('.selectpicker').val('x').selectpicker('render');
Most helpful comment
$('.selectpicker').selectpicker('val', 'Mustard');
$('.selectpicker').selectpicker('val', ['Mustard','Relish']);
http://silviomoreto.github.io/bootstrap-select/methods/#selectpickerval