简体   繁体   English

在Select2 jQuery插件中取消选择选择选项

[英]Deselecting select option in Select2 jquery plugin

I am using the select2 jquery plugin for select dropdown feature in web site. 我正在将select2 jquery插件用于网站中的select下拉功能。 Every select box in not required to be selected for the form submission . 不需要为表单提交选择每个选择框。 I want user to be able to deselect the selected option if he wants to. 我希望用户能够取消选择的选项。 Is there any way I can achieve this using Select2 Plugin. 有什么方法可以使用Select2插件来实现。 Any Help would be appreciated. 任何帮助,将不胜感激。 Thank You. 谢谢。

You can put a blank option(option tag with blank value) in the select box for where you want the user to be able to deselect the value. 您可以在选择框中放置一个空白选项(具有空白值的选项标签),以使用户能够取消选择该值。 In not sure what this has to do with select2. 不确定与select2有什么关系。

If this doesn't solve you problem then let me know what options are you using to initialize select2 plugin or maybe elaborate more on the question. 如果这不能解决您的问题,请告诉我您正在使用哪些选项来初始化select2插件,或者可能在此问题上进行详细说明。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM