【发布时间】:2017-01-24 00:23:32
【问题描述】:
如何在 bootstrap-multiselect 中获取选中的文本。
在onChange函数中,自带值,我使用时的文字
var selectedText = $( "#id_multiSelect option:selected" ).text();
它显示所有选择的内容,没有任何空格。
【问题讨论】:
如何在 bootstrap-multiselect 中获取选中的文本。
在onChange函数中,自带值,我使用时的文字
var selectedText = $( "#id_multiSelect option:selected" ).text();
它显示所有选择的内容,没有任何空格。
【问题讨论】:
您可以迭代选定的选项。
这是一个例子:
$("#id_multiSelect option:selected").each(function() {
console.log(this.text); //this will give you the selected text values one by one ... to get value use this.value in place of this.text
});
【讨论】: