Jquery select2 howto make dont close after selection

  • When using the "Multiple Values ​​Selection Box" http://ivaynberg.imtqy.com/select2/ after each selection discards the square. Is there a way to not do this, so the user can select several of them without an additional click to select a field?

  • Also interested in group options. In the demo url above "Pasific Time Zone", "Mountain Time Zone" are not clickable. How to make it interactive and automatically select child elements?

+11
source share
2 answers

Question 1:

From the documentation, I see this option:

closeOnSelect: false 

This option is true by default, which means that the selection window closes when selected.

So this is a simple plugin call:

 $('#mySelect').select2({ closeOnSelect: false }); 

Question 2:

This question is a bit vague. This is a fairly simple task, but without looking at the plugin files and understanding its logic, it's hard to figure out how to answer - and I don't spend hours. This is something you will have to try on your own, because I personally do not think that you will find anyone here ready to do it for free. He asks for a little.

Take a look at its files and see if you can decide what is happening and try something. People will always be ready to help if you have tried. Good luck.

+28
source
 $('#mySelect').select2({ closeOnSelect: false }); 
-2
source

Source: https://habr.com/ru/post/976814/


All Articles