2011-03-23 126 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