vincent marc Villafuerte vincent marc Villafuerte - 1 year ago 143
PHP Question

how to select the default value of selectpicker using document ready?

I know it can be than by like this

<option value="3" selected>3 minutes</option>

but the I need it on Jquery because the value will come from ajax database.

<div class="col-lg-6">
Log out after
<select class="selectpicker" id="session_pick" name="session_pick" value="30">
<option value="3">3 minutes</option>
<option value="15">15 minutes</option>
<option value="30">30 minutes</option>

Answer Source

You can select values using selectpicker methods

$('#session_pick').selectpicker('val', '3');


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download