2010-10-04 43 views
1

我使用jQuery的自動完成插件在網頁上創建自動完成功能。jQuery自動完成 - 雙擊顯示列表

有誰知道如何讓列表顯示,例如,如果有人輸入了3個字符,然後點擊輸入框,然後回到它?

$("#details_business_trade").autocomplete({ 
    source: resultsSplit, 
    autoFill: true, 
    mustMatch: true, 
    close: function() { $("#createProspect").validate().element("#details_business_trade"); }, 
    mustMatch: true 
}); 

這是到目前爲止我的代碼...

回答

4

可以使用時,它通過使用search method重新集中,這樣的電流值觸發搜索:

$("#details_business_trade").autocomplete({ 
    source: resultsSplit, 
    autoFill: true, 
    mustMatch: true, 
    close: function() { $("#createProspect").validate().element("#details_business_trade"); }, 
    mustMatch: true 
}).focus(function() { 
    $(this).autocomplete("search"); 
}); 

這是不是你的例子,but here's a jQuery UI Demo updated with the same concept,例如搜索「行爲」。

+0

謝謝,但這似乎並不奏效。 – Sjwdavies 2010-10-04 15:41:36

+0

基本上,如果用戶輸入'藝​​術',然後點擊輸入框,但回到它,它立即顯示相關匹配... – Sjwdavies 2010-10-04 15:42:26

+0

@Sjwdavies - 啊,我明白你的後,一瞬間:) – 2010-10-04 15:42:52