Jquery 自动完成自定义数据错误没有这样的方法 'instance' 自动完成小部件实例
Jquery autocomplete custom data error no such method 'instance' for autocomplete widget instance
我正在向文本框添加自动完成功能。
引用 this jQuery 自动完成自定义数据插件。
没有自定义数据代码,它工作正常。我添加了以下自定义数据代码
.autocomplete( "instance" )._renderItem = function( ul, item ) {
return $( "<li>" )
.append( "<a>" + item.label + "<br>" + item.desc + "</a>" )
.appendTo( ul );
};
它抛出错误
no such method 'instance' for autocomplete widget instance
有什么我遗漏的吗?
我正在使用 jQuery v1.11.2 和 jQuery UI - v1.10.3
更新了新版本的语法:我认为他们现在不使用实例。
$("#Id").autocomplete().data("uiAutocomplete")._renderItem = function( ul, item )
{
return $( "<li>" )
.append( "<a>" + item.label + "<br>" + item.desc + "</a>" )
.appendTo( ul );
};
我正在向文本框添加自动完成功能。 引用 this jQuery 自动完成自定义数据插件。
没有自定义数据代码,它工作正常。我添加了以下自定义数据代码
.autocomplete( "instance" )._renderItem = function( ul, item ) {
return $( "<li>" )
.append( "<a>" + item.label + "<br>" + item.desc + "</a>" )
.appendTo( ul );
};
它抛出错误
no such method 'instance' for autocomplete widget instance
有什么我遗漏的吗?
我正在使用 jQuery v1.11.2 和 jQuery UI - v1.10.3
更新了新版本的语法:我认为他们现在不使用实例。
$("#Id").autocomplete().data("uiAutocomplete")._renderItem = function( ul, item )
{
return $( "<li>" )
.append( "<a>" + item.label + "<br>" + item.desc + "</a>" )
.appendTo( ul );
};