Pergunto-me que toda a gente tem publicado sobre valuee textopção para começar a partir <option>e ninguém sugeriu label.
Portanto, estou sugerindo labeltambém, pois é compatível com todos os navegadores
Para obter value(igual a outros sugeridos)
function test(a) {
var x = a.options[a.selectedIndex].value;
alert(x);
}
Para obter option text(ou seja, comunicação ou -Selecionar-)
function test(a) {
var x = a.options[a.selectedIndex].text;
alert(x);
}
OU (nova sugestão)
function test(a) {
var x = a.options[a.selectedIndex].label;
alert(x);
}
HTML
<select onchange="test(this)" id="select_id">
<option value="0">-Select-</option>
<option value="1">Communication</option>
<option value="2" label=‘newText’>Communication</option>
</select>
Nota: No HTML acima para o optionvalor 2, labelretornará newText em vez de Communication
Além disso
Nota: Não é possível definir a propriedade label no Firefox (somente retorno).