我對某些數據使用jQuery UI自動完成功能。現在我有3個自動完成元素,其中2個工作正常,一個沒有。在頁面開始處,他給了我錯誤elem.ownerDocument is null
。當我將文本放入input
字段中時,他找到了結果,但我得到了錯誤this.menu is undefined (jquery.js line 6012)
,它指的是ul list
,其中應顯示結果。jquery自動完成:this.menu undefined
這裏是一些代碼:
$("#iName").autocomplete({
source: widget.festivals_list,
autofocus: true,
focus: function (e, ui) {
return false;
},
search: function (event, ui){
ownFest = true;
$("#iDate").removeAttr("disabled");
$("#iTime").removeAttr("disabled");
},
select: function (event, ui) {
ownFest = false;
$(event.target).val(ui.item.label);
selectedN = ui.item.value;
$(widget.festivals).each(function fn(){
if(this.id == ui.item.value){
$("#iDate").val(this.date).attr("disabled", "disabled");
$("#iTime").val(this.time).attr("disabled", "disabled");
}
});
return false;
}
});
HTML代碼:
<table>
<tr>
<td>Type the name</td>
</tr>
<tr>
<td><input type="text" id="iFest"/></td>
</tr>
</table>
這造成我的input
標記屬性的典型數量並創建ul
列表。
<ul class="ui-autocomplete ui-menu ui-widget ui-widget-content ui-corner-all" role="listbox" aria-activedescendant="ui-active-menuitem"></ul>
<input id="iFest" class="ui-autocomplete-input" type="text" autocomplete="off" role="textbox" aria-autocomplete="list" aria-haspopup="true">
有人也有這些問題嗎? 感謝
(使用jQuery 1.5.2和jQuery UI 1.8.11)
感謝
更改了我的問題的內容 – jeroenjoosen 2011-05-05 13:22:26