Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Get current text of dropdownlist

Posted on 2011-09-29
4
Medium Priority
?
259 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:Tom Knowlton
  • 2
  • 2
4 Comments
 
LVL 83

Accepted Solution

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

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

Author Closing Comment

by:Tom Knowlton
ID: 36816249
thx
0
 
LVL 83

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:Tom Knowlton
ID: 36816744
Okay...thanks!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

The most up-to-date version of this article is on my Blog https://iconoun.com/blog/
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

916 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