jquery.chosen.js查詢時(shí),chosen默認(rèn)從第一個(gè)字符搜索,所以寫(xiě)中間的字符搜索時(shí),是搜索不出來(lái)的
若想實(shí)現(xiàn)中間字符的模糊查詢,下面的js中(search_contains屬性為true即可)可以讓chosen搜索選項(xiàng)的中間及末尾字符
no_results_text是搜索不到內(nèi)容時(shí),顯示的提示語(yǔ)
placeholder_text是下拉選項(xiàng)默認(rèn)顯示的文字
disable_search_threshold是select的option選項(xiàng)大于等于此值,才會(huì)顯示查詢的文本框
jQuery(".chosen").chosen({
no_results_text: "My language message.",
placeholder_text : "My language message.",
search_contains: true,
disable_search_threshold: 10
});
或者是直接將jquery.chosen.js的源碼修改了
將this.search_contains = this.options.search_contains || !1
改為this.search_contains = true || !1
網(wǎng)速查到的資料,記錄一下,以供不時(shí)之需!