【发布时间】:2018-07-24 05:27:24
【问题描述】:
我正在使用selec2 作为下拉菜单。
我正在从后端获取数据,并且可以在 select2 中成功显示。但我有一些数据在单词之间有一个以上的空格。如下所示
Test Your Code
I Am Developer
Testing Done
HTML 代码
<select id='my_select' style="width:300px">
<option>Test Your Code</option>
<option>I Am Developer</option>
<option value="An">Testing Done</option>
</select>
脚本
$("select").select2();
当我尝试使用空格搜索数据时,它显示No matches found。
我也试过这个stackoverflow solution,但它不起作用
请查看我的jsfiddler。
【问题讨论】:
-
您想从选项文本中删除不需要的空格吗?
-
@Mamun 不,我不想弄乱现有数据
标签: javascript jquery html jquery-select2