<select id="my-select">
<option value="1">This is one</option>
<option value="2" selected>This is two</option>
...
</select>
Is there a way to get the text value of the selected option?
$('#my-select').val();
gives me 2, i want to get This is Two instead.
How?
<select id="my-select">
<option value="1">This is one</option>
<option value="2" selected>This is two</option>
...
</select>
Is there a way to get the text value of the selected option?
$('#my-select').val();
gives me 2, i want to get This is Two instead.
How?
Share Improve this question asked Jan 19, 2011 at 3:32 MarvzzMarvzz 1,5653 gold badges15 silver badges22 bronze badges1 Answer
Reset to default 10What you want is
- Get the selector for finding the selected option in the select box
Use
.text()
on the selector.$('#my-select option:selected').text();
See a working demo