193
rated 0 times
[
194]
[
1]
/ answers: 1 / hits: 18785
/ 15 Years ago, sun, february 28, 2010, 12:00:00
I have a list like this:
<select name=select_list_name id=list_id>
<option value=>Select Option</option>
<option value=value1>Option 1</option>
<option value=value2>Option 2</option>
...
...
</select>
I am trying to get the text value of the currently selected option in a select list. I looked at this thread: jQuery get specific option tag text
and tried this:
$(#list_id option:selected).text()
But this only gets me the first options text (Select Option
) regardless of which option has been selected.
I tried another way:
$([name=select_list_name] option:selected).text()
That gets me the first option's text concatenated with the selected options's text (Select OptionOption 2
if I select Option 2).
Any idea on why?
More From » jquery