Choices icon indicating copy to clipboard operation
Choices copied to clipboard

Do not remove <option>'s inside the <select>.

Open EmeraldWeb opened this issue 6 years ago • 5 comments

I really like this library, but there is one unpleasant thing for me - clearing the <option> as a result of the library. What prevents future improvements and maintenance through cross-functional scripts. I don’t know why you don’t save the original tag tree inside <select>, if this is necessary, then please add a parameter to preserve the original data structure.

EmeraldWeb avatar Jun 14 '19 11:06 EmeraldWeb

I just ran into a bug in the Webform module for Drupal related to <option> tags being removed and re-added.

The bug was related to trying to cache an option element via jQuery (see below) and then having this option element being removed by ChoicesJS.

var $otherOption = $element.find('option[value="_other_"]');

This is not a major issue and easy to work-around but I felt it was worth noting here.

jrockowitz avatar Sep 03 '19 18:09 jrockowitz

I also likes the lib, but turns out i can't use this plugin because the choices.js doesn't preserve the select options , so i can't attach html5 data to the option and use it for another js function. sadly i have to go back to select2 since it does preserve the options.

I hope this will implemented in next version. Ideally choices.js is the interface to a hidden select, but it does not modify the original select tag just like select2.

dexcell avatar Oct 09 '19 05:10 dexcell

Happy to review a PR that resolves this 👍

jshjohnson avatar Oct 09 '19 08:10 jshjohnson

Is there some update? I'm using version 9.0.1 and the issue still remains.

dominik-tran avatar Mar 24 '21 10:03 dominik-tran

Still in 10.2 :( I don't understand why something like this was a feature in the first place?

weha avatar Jan 05 '24 16:01 weha