aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes JQuery: Getting Select Options Label Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "JQuery: Getting Select Options Label" Watch "JQuery: Getting Select Options Label" New topic
Author

JQuery: Getting Select Options Label

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

So I know the cool old fasioned way of getting to a select element options label:

document.getElementById('modelId').options[document.getElementById('modelId').options.selectedIndex].text

My first question is does JQuery have a built in util function to do this?
My second question is, if not, I've started my own but I can't seem to figure out how to return the value from the custom function:



And then doing something like:

jQuery('#someSelectElement').getSelectedLabel()

is returning 'undefined'.

Thanks for any help.


GenRocket - A Test Data Generation Platform
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

Figured it out:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JQuery: Getting Select Options Label
 
Similar Threads
JSON+Jquery
need help in jquery
Trying to use tagify plug-in to populate text field with dynamic labels
Ajax code getting null value
Sorting array in bind("change", function()