tags:

views:

30

answers:

2

Hi there

I know I can get the value using $("#dropdown").val()

does anybody know how i get the label?

Cheers

+8  A: 
var text = $("#dropdown").find("option:selected").text();

which is the same as

var text = $("#dropdown option:selected").text();
mkoryak
You beat Nick in speed. That's a feat on it's own right.
BBonifield
@BBonifield, *Vive la Revolución!* =) @mkoryak, +1 (and not *just* for beating Nick)
David Thomas
@BBonifield - It's not that hard to be faster anyone really...different people are mapped to different SO servers (IP hash) which have a cache refreshing at staggered intervals...which means one person may never see a question even appear on their unanswered list before it's been answered and upvoted before *that* server's cache refreshes, even constantly refreshing :)
Nick Craver
@Nick, uhm, yea, nice theory.. just admit defeat!! ;)
mkoryak
@mkoryak - It's true :) During the day I don't even see a ton of questions even in the categories I'm most active in, same goes for all users...you just don't realize it unless you look at the all questions by recent list :) (That is, if you *usually* look at "Unanswered" as I do)
Nick Craver
It is still a duplicate ;)
Felix Kling
+1  A: 

Use the :selected selector (to get the selected <option>) and get the .text(), for example:

$("#dropdown :selected").text()
Nick Craver