<select class='selb' id='selbauth' >
this works:
$('#selbauth option[value="abc"]').attr('selected','selected');
the same but selecting not by value but by text - doesn't work:
$('#selbauth option[text="lorem"]').attr('selected','selected');
I tried another way:
function selbytext(dd, txt){
for (var i = 0; i < dd.options.length; i++) {
if (dd.options[i].text == txt) {
dd.selectedIndex = i;
break;
}
}}
selbytext($('#selbauth'), 'lorem');
error:
Cannot read property 'length' of undefined
Any help?