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

Allow options outside of optgroup #8

Open
jgbishop opened this issue Jan 8, 2018 · 1 comment
Open

Allow options outside of optgroup #8

jgbishop opened this issue Jan 8, 2018 · 1 comment

Comments

@jgbishop
Copy link

jgbishop commented Jan 8, 2018

This plugin is great, but it doesn't seem to allow a setup where I can have options outside of an optgroup:

<select>
  <optgroup>
    <option>
    <option>
  </optgroup>
  <option>
</select>

Is there a tweak I can make somewhere to allow this case?

@linacs
Copy link

linacs commented Dec 12, 2023

For anyone wanting to spare 3 hours, the solution is very easy:
line 15, replace:
this.$element.find(':not(.selected-custom) :selected, .selected-custom').each(function () {
by:
this.$element.find(':not(.selected-custom) :selected, .selected-custom, >:selected').each(function () {

This just also consider directly under , not only through (which is filtered by the class "selected-custom").

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

No branches or pull requests

2 participants