2011-03-23 124 views
2

我有一個jQuery-UI自動完成功能,它加載之前加載它的窗體加載。jQuery-UI自動完成不顯示選擇

$('#groupset').autocomplete({ 
    source: 'ajax/php/leeruns.php', 
    minlength: 2, 
    select: function(event, ui) { 
     if(ui.item.groupset_id){ 
      $('#groupsetdesc').val(ui.item.description); 
      if(groups.loaded!=ui.item.groupset_id)groups.load(ui.item.groupset_id); 
     } else { 
      $('#groupsetdesc').val(''); 
     } 
    } 
}); 

相關的HTML是:

<div><label for='groupset'>Groupset Name</label> 
    <input name='filename' id='groupset' type='text' value='' ></div> 
<div><label for='groupsetdesc'>Groupset Description</label> 
    <input name='groupsetdesc' id='groupsetdesc' type='text' value=''></div> 

如果鍵入 「GR」 在輸入框中,螢火告訴我,返回該JSON:

[{"value":"Group_by_Column", 
    "groupset_id":"1", 
    "description":"12 groups, each of 8 wells from one column", 
    "create_date":"2010-02-24 13:27:26"}, 
{"value":"Group_by_Row", 
    "groupset_id":"2", 
    "description":"8 groups of 12 wells, each from 1 row", 
    "create_date":"2010-06-02 14:36:33"} 
] 

我希望看到包含從自動完成功能返回的條目的仿製下拉菜單。但沒有選擇出現。這在IE8和FF4中是可複製的。任何想法我失蹤?

jQuery的V1.5.1 jQuery的UI 1.8.11

回答

2

這是要解決的問題與自動完成的代碼是不是在所有的野獸。在同一頁面上,我還加載了jQuery validate plugin。驗證版本1.7與自動完成有某種不兼容性。一旦我升級驗證到v1.8,自動完成再次工作。

我希望這可以幫助別人。

+0

這也適用於我。 – 2011-06-20 13:37:33

+0

爲我節省了很多時間! – jvanderh 2012-03-08 20:49:44