【发布时间】:2015-04-24 13:03:27
【问题描述】:
在我的 select2 中,我使用 minimumInputLength 选项在一定长度后开始过滤。
selectExample.select2({
minimumInputLength: 2
});
但是在使用 append() 函数动态追加新选项后,这个 minimumInputLength 选项不起作用。
selectExample.append('<option value="10">Ten</option>');
究竟发生了什么?是否有特定的方法可以为 select2 添加新选项?
我当前使用的解决方案是重新声明 .select2() 并包含 minimumInputLength 选项。
【问题讨论】:
-
看这里:http://stackoverflow.com/a/17348414/4202224 或看
data-select2 的选项
标签: javascript jquery jquery-select2