从文本框中获取多个选择下拉列表中的所有选定值 [英] Get all selected values from muliple selection dropdownlist with textbox

查看:71
本文介绍了从文本框中获取多个选择下拉列表中的所有选定值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hii,

我使用select2插件来使用多个选择下拉列表和文本框。

现在有问题可以获得所有选定的值。它仅返回第一个选定的值。给我一些关于此的提示。

Hii,
I use select2 plugin fro use multiple selection dropdownlist with textbox.
Now there is problem to get all selected values. It returns only first selected value. Give me some tips regarding this.

推荐答案

大多数多选框都有第二组'Selected'属性。 SelectedItems,SelectedValues等,它们为您提供所有选定的项目。



编辑:

我在select2上做了一点搜索,这就是出现了。这个回答的问题似乎与你在这里提出的问题非常相似。



选项1:



Most multiple selection boxes have both a second set of 'Selected' properties. SelectedItems, SelectedValues etc. which give you all the selected items.

Edited:
I did a little search on select2 and this is what showed up. The question this was answering appeared to be very similar to the one you asked here.

Option 1:

var results = [];


(#individualfront)。select2({
multiple:true,
query:function (查询){
var data = {results:[]};
("#individualsfront").select2({ multiple: true, query: function (query){ var data = {results: []};


.each(yuyu,function(){
if(query.term.length = = 0 || this.text.toUpperCase()。indexOf(query.term.toUpperCase())> = 0){
data.results.push({id:this.id,text:this.text });
}
});

results = data.results; //< =====
query.callback(data);
}
});
.each(yuyu, function(){ if(query.term.length == 0 || this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0 ){ data.results.push({id: this.id, text: this.text }); } }); results = data.results; //<===== query.callback(data); } });


这篇关于从文本框中获取多个选择下拉列表中的所有选定值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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