简体   繁体   English

jQuery Autocomplete(1.8.5) - 未捕获的TypeError,属性'source'不是函数

[英]jQuery Autocomplete (1.8.5) - Uncaught TypeError, property 'source' is not a function

I am attempting to use the jQuery autocomplete widget which I have used previously on earlier versions of jQuery. 我试图使用我之前在早期版本的jQuery上使用的jQuery自动完成小部件。

With the code I'm currently using (and jQuery UI 1.8.5) I am getting the following error when typing a letter in the initialised autocomplete input field: 使用我正在使用的代码(以及jQuery UI 1.8.5),在初始化的自动完成输入字段中键入字母时出现以下错误:

jquery-ui-1.8.5.custom.min.js:320Uncaught TypeError: Property 'source' of object #<an Object> is not a function

The autocomplete code is basically the jQuery example documentation (added to my page with other JS on it): 自动完成代码基本上是jQuery示例文档(添加到我的页面上,其他JS上面):

<input type="text" id="example" />
<script type="text/javascript">
    var data = "Core Selectors Attributes Traversing Manipulation CSS Events Effects Ajax Utilities".split(" ");
    $("#example").autocomplete(data);
</script>

Anyone have any suggestions? 有人有什么建议吗?

Thanks in advance. 提前致谢。

我认为应该是:

$("#example").autocomplete({ source: data });

It looks like you are trying to call the autocomplete widget in jQuery UI the same way that the deprecated autocomplete jQuery plugin was called. 看起来你试图在jQuery UI中调用自动完成小部件,就像调用不推荐的自动完成jQuery插件一样 The entire API is different, so take a look at the migration guide , but your example would be 整个API是不同的,所以请看一下迁移指南 ,但是您的示例是

$("#example").autocomplete({ source: data });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM