我对某些数据使用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