2010-10-04 44 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