gpt4 book ai didi

javascript - 选择带有空格的 jQuery 插件搜索

转载 作者:可可西里 更新时间:2023-11-01 02:52:21 24 4
gpt4 key购买 nike

我对 Chosen jQuery plugin 有疑问.当我尝试搜索其中包含空格的字符串时,即使它确实存在,我也得不到任何结果。

例如:如果我输入字符串“and barbu”,我什么也得不到。但是当我写“antigua and barbu”时,我得到了结果。

我应该怎么做才能解决这个空间问题?

最佳答案

在这里回答:Changing search behavior in jquery plugin Chosen只需添加

jQuery('select').chosen({search_contains:true}) ;

正如选项文档中提到的: http://harvesthq.github.io/chosen/options.html

search_contains false 默认情况下,Chosen 的搜索匹配从单词的开头开始。将此选项设置为 true 允许匹配从单词中的任何位置开始。这对于在 () 和 [] 中包含大量特殊字符或短语的选项特别有用。

关于javascript - 选择带有空格的 jQuery 插件搜索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19061947/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com