image-picker icon indicating copy to clipboard operation
image-picker copied to clipboard

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

Open juhah opened this issue 9 years ago • 2 comments

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.

juhah avatar Apr 01 '15 11:04 juhah

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?

rvera avatar Apr 01 '15 16:04 rvera

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.

juhah avatar Apr 02 '15 06:04 juhah