Jquery input select option value

Posted: Arhitektor Date of post: 09.07.2017

And I'd like to get the value of the option selected.

jquery input select option value

The '2' is the value I need to get and not 'Option 2'. One of my options didn't have a value: I was trying to use if! By posting your answer, you agree to the privacy policy and terms of service.

Stack Overflow Questions Developer Jobs Documentation beta Tags Users. Sign up or log in to customize your list. Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us.

Log In Sign Up.

html - jQuery get selected option value (not the text, but the attribute 'value') - Stack Overflow

Join the Stack Overflow Community. Stack Overflow is a community of 7. Join them; it only takes a minute: Okay, I jquery input select option value this code: This was the simplest answer. Note that if the selected option has no value attribute specified, the label i. Might not always be what you want. Of course, in most applications, value is specified.

I just wanted to share my experience and my reputation is not enough to comment.

.val() | jQuery API Documentation

David Torres 9 Did the newest version of chrome not jquery input select option value it, or was forex major currency pairs IE that didnt support it? It was in the newest version of Chrome.

Maybe also in Firefox, but not sure. Double check for typos.

Here is an example that shows what I just said: You need to add an id to your select. Marcus 3, 2 21 From what I've read using an ID as a selector is the fastest method. Usman 2, 2 19 Geziel Carvalho 36 1 7.

jquery input select option value

Gavin 2, 1 25 Look at the example: Sign up or log in StackExchange. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name.

Get selected value of a dropdown's item using jQuery - Stack Overflow

Stack Overflow works best with JavaScript enabled. Was that browser specific case? MathOverflow Mathematics Cross Validated stats Theoretical Computer Science Physics Chemistry Biology Computer Science Philosophy more 3. Meta Stack Exchange Stack Apps Area 51 Stack Overflow Talent.

Rating 4,7 stars - 930 reviews
inserted by FC2 system