jquery select2如何使select不要关闭 [英] jquery select2 howto make dont close after select

查看:1013
本文介绍了jquery select2如何使select不要关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  1. 使用多值选择框时, http:// ivaynberg.github.io/select2/
    选择框在每次选择后退回。
    有没有办法不这样做,所以用户可以选择少数几个而无需额外点击选择框?

  1. 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?

同样对组选项感兴趣。在上面的演示网址中,Pasific Time Zone,Mountain Time Zone无法点击。如何使其可点击并自动选择子项?

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?


推荐答案

问题1:

来自文档我可以看到这个选项:

From the documentation I can see this option:

closeOnSelect: false

默认情况下,此选项设置为true,表示选择框在选择时关闭。

This option is set to true by default, meaning the select box closes on select.

所以,这是一个简单的插件调用:

So, this is a simple call of the plugin:

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

问题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.

这篇关于jquery select2如何使select不要关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆