Setting select list 'selected' based on text
Setting select list 'selected' based on text
by Avinashullal
HTML
<select>
<option value="0">One</option>
<option value="1">Two</option>
</select>
JavaScript
var text1 = 'Two';
$("select option").filter(function() {
//may want to use $.trim in here
return $(this).text() == text1;
}).prop('selected', true);