Bootstrap-select: How to set default value?

Created on 9 Jan 2017  路  5Comments  路  Source: snapappointments/bootstrap-select

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?

Most helpful comment

$('.selectpicker').selectpicker('val', 'Mustard');
$('.selectpicker').selectpicker('val', ['Mustard','Relish']);
http://silviomoreto.github.io/bootstrap-select/methods/#selectpickerval

All 5 comments

$('.selectpicker').selectpicker('val', 'Mustard');
$('.selectpicker').selectpicker('val', ['Mustard','Relish']);
http://silviomoreto.github.io/bootstrap-select/methods/#selectpickerval