Bootstrap Select - Set selected value by text -
how can change drop down if know text , not value?
here select -
<select id="app_id" class="selectpicker"> <option value="">--select--</option> <option value="1">application 1</option> <option value="2">application 2</option> </select>
you can use jquery filter() , prop() below
jquery("#app_id option").filter(function(){ return $.trim($(this).text()) == 'application 2' }).prop('selected', true);
using bootstrap select,
jquery("#app_id option").filter(function(){ return $.trim($(this).text()) == 'application 2' }).prop('selected', true); $('#app_id').selectpicker('refresh');
Comments
Post a Comment