jquery autocomplete this.source不是函数错误 [英] jquery autocomplete this.source is not a function error

查看:132
本文介绍了jquery autocomplete this.source不是函数错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在输入字段上实现了自动完成功能,但是框没有显示,而firebug返回this.source不是函数。我在同一页面的其他字段上使用了自动完成功能,没有任何问题。 (两个textarea的)。

I've implemented autocomplete on an input field, but the box does not show up and firebug returns "this.source is not a function". I've used autocomplete on other fields of the same page without any problems. (two textarea's).

我正在使用以下代码进行调试,如果我从脚本文件或Firebug命令行运行,效果相同。

I'm using the following code to debug, same effect if I run from script file or Firebug command line.

var fakedata = ['test1','test2','test3','test4','ietsanders'];
$("#omschrijving").autocomplete(fakedata);

运行jquery 1.4.2和jquery ui 1.8.2,两个缩小版本。

running jquery 1.4.2 and jquery ui 1.8.2, both minified versions.

有没有人知道自动完成在textareas上是如何工作的,但是输入会导致这种故障?

Does anyone have an idea how autocomplete works fine on the textareas but causes this malfunctioning on inputs?

错误&堆栈跟踪:

Error & Stack trace:

this.source is not a function
http://facturatie.autodealers.nl/dev/resources/js/jquery-ui-1.8.2.custom.min.js
Line 570
close(Object { name="a"})jquery....min.js (regel 570)
close(Object { name="a"}, Object { name="c"})jquery....min.js (regel 570)
response()


推荐答案

答案是自动完成的第一个参数应该是包含源的对象属性。这是有效的

Answer is that the first parameter of the autocomplete should be an object containing the "source" property. This works

var fakedata = ['test1','test2','test3','test4','ietsanders'];
$("#omschrijving").autocomplete({source:fakedata});

这篇关于jquery autocomplete this.source不是函数错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆