0
所以我需要更改bootstrap duallist插件,以便过滤器首先从键入的关键字中显示最相关的选项。然后将过滤的选项方框内突出(这将文本的颜色是基于其相关性等)bootstrap双列表 - 通过JavaScript手动选择选项?
,直到我想选择的选项,并放置到选定的盒子,它工作正常了。一旦选项被点击,我尝试使用jquery添加'selected'属性。
var nonselectedBox = $("#bootstrap-duallistbox-nonselected-list_bundle")
nonselectedBox.find("option").removeAttr("selected");
$(this).find("li.selected").each(function() {
nonselectedBox.find("option[value='" + $(this).text() + "']")
.attr("selected", "selected");
});
这个工程,我可以看到所有的选项通过jQuery的DOM更改;但是一旦移动箭头被按下,它就不会将选项添加到选定列表中。
我已经通过了文档,但是没有任何手动选择选项的功能。那我该怎么做?