groenroos / minimalect

Minimal select replacement for jQuery
350 stars 52 forks source link

Non-unique value causing multiple selection #52

Open patrickgalbraith opened 10 years ago

patrickgalbraith commented 10 years ago

If the option value is not unique then it causes multiple options to be selected.

See this fiddle http://jsfiddle.net/a90wqg27/ and try selecting Bicycling, mountain, general and Bicycling, BMX will also be selected.

It is valid to have multiple options with the same value so you might want to add a unique identifier to the option using a data attribute to keep track of each option rather than assuming that the values will be unique.

In this case I could easily work around the issue by using <option data-value="x"> and fixing it with javascript but it would be nice to not have to do that.

patrickgalbraith commented 10 years ago

Actually it seems to work fine if live is set to false. So it might have something to do with the live option.

See http://jsfiddle.net/a90wqg27/1/