Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change is_selected() to use selectedIndex property for selection instead of $.val() #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

juhah
Copy link

@juhah juhah commented Apr 1, 2015

Disabled select might not show the selected value due to $.val() returning null if the select is disabled, see: http://bugs.jquery.com/ticket/13097.

…ead of $.val()

Disabled select might not show the selected value due to $.val() returning null if the select is disabled, see: http://bugs.jquery.com/ticket/13097.
@rvera
Copy link
Owner

rvera commented Apr 1, 2015

Looks good to me. A few questions:

  • Is this reliable across browsers? or should we use this as a fallback only when the select is disabled.
  • Does this play nice with multi select elements?

@juhah
Copy link
Author

juhah commented Apr 2, 2015

Yes, might be better as a fallback solution... selectedIndex will return the first selected option for multiple selects so in that case it's best to walk the options list and gather the selected ones to an array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants