1

How can I get the text of the selected item from a dropdown using jQuery?

1 Answer 1

4

Using the following URL, I came up with this solution:

http://www.mail-archive.com/[email protected]/msg17717.html

$("#myDropdown option:selected").text() 

Not sure if this is the best solution, but it seems to work great.

Sign up to request clarification or add additional context in comments.

2 Comments

using the > selector is overkill and would actually break the script if you used <optgroup> elements. Just make it #myDropdown option:selected intead.
Great idea! I always seem to forget about the additional elements you can throw inside the select element!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.