I've found this approach using show
and hide
methods of jQuery, but this doesn't work for me in combination with select2 library (v4.0.0).
My example looks like this: JSFiddle
Is there a way (and maybe an example) to do chained selection with this plugin?
There are multiple ways to chain Select2. Hiding <option>
elements within a <select>
is not the way that I would recommend.
Select2 does not try to detect whether or not an element is visible and instead depends on options being added and removed from the <select>
, which is the guaranteed way to ensure that a result is not visible, no matter what plugin you use.