Solved

Get current text of dropdownlist

Posted on 2011-09-29
4
254 Views
Last Modified: 2012-06-21
Please provide jQuery code to get the text of the dropdownlist.

This is not based upon what is selected, just what appears inside the text.  I want to get the text whether or not something has ever been picked from the drop down list items or not.
0
Comment
Question by:knowlton
  • 2
  • 2
4 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 36816142
use : $("option:selected").text()

test page : http://jsfiddle.net/jzAzM/
0
 
LVL 5

Author Closing Comment

by:knowlton
ID: 36816249
thx
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36816265
for a specific dropdown : $("option:selected", "#yourdropdownid").text()

http://jsfiddle.net/jzAzM/2/
0
 
LVL 5

Author Comment

by:knowlton
ID: 36816744
Okay...thanks!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

by Julian Matz As of jQuery (http://jquery.com/) 1.4 the .live() method (http://api.jquery.com/live/) supports custom events as well as some standard JavaScript events that it previously didn't support. Among these is the submit event. Unlike …
I have answered several questions lately that were solved utilizing the power of jQuery's AJAX functions, so I thought I would write an article demonstrating the ease of use. Why should I use jQuery as opposed to regular JavaScript? Now I know…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question