jquery select2 如何在选择后不关闭
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26395096/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
jquery select2 howto make dont close after select
提问by smbhere
When using "Multi-Value Select Boxes" http://ivaynberg.github.io/select2/slect box drop back after each selection. Is there the way not to do it, so user can select few of it without extra click to select box?
Also interested in group options. In demo url above, "Pasific Time Zone", "Mountain Time Zone" not clickable. How to make it clickable and autoselect child items?
使用“多值选择框”时,http://ivaynberg.github.io/select2/ 每次选择后都会回退选择框。有没有办法不这样做,这样用户就可以选择很少的内容而无需额外点击选择框?
也对组选项感兴趣。在上面的演示网址中,“太平洋时区”、“山区时区”不可点击。如何使其可点击并自动选择子项?
回答by TheCarver
Question 1:
问题 1:
From the documentationI can see this option:
从文档中我可以看到这个选项:
closeOnSelect: false
This option is set to true by default, meaning the select box closes on select.
默认情况下,此选项设置为 true,这意味着选择框在选择时关闭。
So, this is a simple call of the plugin:
所以,这是插件的一个简单调用:
$('#mySelect').select2({
closeOnSelect: false
});
Question 2:
问题2:
This question is a bit vague. It's a fairly simple task, but without going through the plugin's files and understanding its logic, it's difficult to know how to answer — and I'm not spending hours trying. This is something you'll have to try yourself, as I personally don't think you'll find anyone here willing to do that for free. It's asking a little bit much.
这个问题有点含糊。这是一项相当简单的任务,但如果不浏览插件的文件并了解其逻辑,就很难知道如何回答——而且我不会花几个小时尝试。这是您必须自己尝试的事情,因为我个人认为您不会在这里找到愿意免费这样做的人。它的要求有点高。
Take a look at its files and see if you can work out what is going on and try something. People will always be willing to help if you've tried. Good luck.
看看它的文件,看看你是否可以弄清楚发生了什么并尝试一些东西。如果您尝试过,人们将永远愿意提供帮助。祝你好运。