不灭的火

革命尚未成功,同志仍须努力下载JDK17

作者:AlbertWen  添加时间:2020-03-12 18:30:11  修改时间:2025-04-03 13:11:28  分类:06.前端/Vue/Node.js  编辑

jquery.chosen.js 查询时,chosen默认从第一个字符搜索,所以写中间的字符搜索时,是搜索不出来的。

若想实现中间字符的模糊查询,下面的js中(search_contains 属性为 true 即可)可以让chosen搜索选项的中间及末尾字符:

  • no_results_text:是搜索不到内容时,显示的提示语
  • placeholder_text:是下拉选项默认显示的文字
  • disable_search_threshold:是select的option选项大于等于此值,才会显示查询的文本框
1
2
3
4
5
6
jQuery(".chosen-select").chosen({
    no_results_text: "My language message."
    placeholder_text : "My language message."
    search_contains: true,
    disable_search_threshold: 10
});