Jquery get select option disabled

Jquery get select option disabled

Posted: Rifka Date: 29.06.2017

I have a multiple select on my page, and I have an option disabled so that the user can't unselect them, but I can't work out how to get the value of the disabled option. Note the disabled option changes based on other variables, but it only gives me selected non-disabled values.

Can anyone let me know if this can be done and how?

Dropdown values disable/Enable JQuery with values already selected - jQuery Forum

I'm using Chosen , hence why the disabled option. I did find this article on the JQuery Bug Site which said. The long-standing logic in. The change just applies the same behavior for select-one now for consistency. Please bear in mind that when you submit the form disabled options wont be submitted even if they are selected.

If you're submitting via AJAX, then you can grab the values as shown above. If there's always just one selected disabled option element you can target it using:.

javascript - jQuery fetch disabled select option value - Stack Overflow

By posting your answer, you agree to the privacy policy and terms of service. Stack Overflow Questions Developer Jobs Documentation beta Tags Users.

jquery get select option disabled

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. Join the Stack Overflow Community. Stack Overflow is a community of 7. Join them; it only takes a minute: Get Value of Disabled Option in Select Multiple Jquery Ask Question. I'm using Chosen , hence why the disabled option Fiddle: But that didn't work for me. I don't see an issue.. Skram it's a multiple select, that's what the issue is.

I reproduced the problem: It appears to be a deliberate design decision. If there's always just one selected disabled option element you can target it using: I've got a hidden input to handle that element: Glad I could help.

You can get the value of a disabled element by doing something like this: Nope tried that and option: Looks like there's a syntax error here? Sign up or log in StackExchange.

Sign up using Facebook. Sign up using Email and Password.

Post as a guest Name. Stack Overflow works best with JavaScript enabled. 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,8 stars - 646 reviews
inserted by FC2 system