In jquery 1.3.2, the following works:
$('#c').val('325');
or
// earlier - define a text-equals selector
jQuery.extend(jQuery.expr[":"], {
"text-equals": function (a, i, m) {
return (a.textContent||a.innerText||jQuery(a).text()||'')==m[3];
}
});
// later - use it
$red = $('#c option:text-equals(Red)');
$('#c').val($red.val());
The custom selector is one possibility. You could also do exactly the same thing in a filter()
callback, for example.