我想讓jQuery UI自動完成只搜索我的字符串的前幾個字母。我認爲我可以用jQuery UI做關鍵/價值的事情,但我不確定這是否適用。jQuery UI自動完成部分匹配
我有以下字符串:
AGREE Agreement by and between BLANK, in BLANK, of the county records.
只有AGREE
應搜索,而不是字符串的其餘部分。 AGREE
是用戶將搜索的文本代碼。
這裏是我的簡單的代碼:
var availableTags = [
"AGREE Agreement by and between BLANK, in BLANK, of the county records.",
"CONDO Covenants, conditions, restrictions, reservations, terms, provisions, easements, liens for assessments, options, powers of attorney and limitations on title as set forth in the Ohio Revised Code Chapter 5311, or as set forth in the Declaration of Condominium ownership and Bylaws as recorded in BLANK, as amended, plat BLANK, of the county records."
];
$("#tags").autocomplete({
source: availableTags
});
只有第一句話AGREE
和CONDO
應搜索,而不是字符串的其餘部分。這可能/可行嗎?
可能的[jQuery UI自動填充小部件搜索配置]的副本(http://stackoverflow.com/questions/2382497/jquery-ui-autocomplete-widget-search-configuration)。看看[this](http://stackoverflow.com/a/2405109/303270)的答案。 – fardjad 2013-03-02 20:41:05