<select>
<option value="test">label </option>
</select>
The value can be retrieved by $select.val().
What about the label?
Is there a solution that will work in IE6?
<select>
<option value="test">label </option>
</select>
The value can be retrieved by $select.val().
What about the label?
Is there a solution that will work in IE6?
I found this helpful
$('select[name=users] option:selected').text()
When accessing the selector using the this keyword.
$(this).find('option:selected').text()
In modern browsers you do not need JQuery for this. Instead use
document.querySelectorAll('option:checked')
Or specify any DOM element instead of document
<SELECT id="sel" onmouseover="alert(this.options[1].text);"
<option value=1>my love</option>
<option value=2>for u</option>
</SELECT>
Created working Plunker for this.
https://plnkr.co/edit/vR9aGoCwoOUL9tevIEen
$('#console').append("<br/>"+$('#test_s :selected').text())