websemantics / Image-Select

Image Select is an extension of Chosen, a jQuery plugin that makes long, unwieldy select boxes much more user-friendly. It provides image support for Single and Multi select HTML tags.
http://websemantics.github.io/Image-Select
MIT License
148 stars 44 forks source link

fixed wrong images when using optgroup #7

Closed SimonErich closed 9 years ago

SimonErich commented 9 years ago

When using optgroup the images would be assigned to the wrong element, because of jquery selector. It also calculated the optgroups as key elements for "i". By using :not() we excluded the optgroup elements.

websemantics commented 9 years ago

Hi SimonErich, thanks for this, .. I couldn't merge your request, can you do a pull and try again?

SimonErich commented 9 years ago

Hi, alright, I just looked at it and it interfered with klebervirgilio changes. But I found an even better solution that makes it possible to add images to optgroups as well, by not only using "chosen.form_field.options" but "$(chosen.form_field).find('optgroup, option')" to walk optgroups and options. Hope this helps