javascript - 更新后 jQuery 自动完成组合框不起作用

标签 javascript jquery combobox autocomplete

我最近将 jquery 从 1.8 更新到 1.11,jquery 组合框爆炸了。

起初它给出了 _renderItem is undefined 的错误,所以在检查了一些 stackoverflow 帖子后发现 input.data( "autocomplete")._renderItem = function( ul, item )...应更改为 input.data( "ui-autocomplete")._renderItem = function( ul, item )。这解决了 _renderItem 问题,但整个组合框根本不起作用。它仅表示为一个没有任何功能的文本框。

combobox not working , and not displaying the dropdowns 这是代码部分

input.data( "ui-autocomplete" )._renderItem = function( ul, item )
        {                
            return $( "<li></li>" )
                .data( "item.autocomplete", item )
                .append( "<a>" + item.label + "</a>" )
                .appendTo( ul );
        };

请帮帮我,我已经被困在这个问题上 6 个小时了......

最佳答案

在此链接中查看从 1.8 到 1.9 的升级指南:

http://jqueryui.com/upgrade-guide/1.9/

您会注意到有几件事发生了变化,即:

Preparing for jQuery UI 1.10

The API redesigns deprecate a lot of functionality, which will be removed in 1.10. You don't have to wait for the 1.10.0 release in order to find out if your code will work when the 1.8 APIs are removed. You can use the $.uiBackCompat flag to test this with any 1.9 release

另一个例子:

Slider now uses ui-slider-handle-index instead of index.ui-slider-handle. Autocomplete now uses ui-autocomplete-item instead of item.autocomplete.

尝试找出 1.8 到 1.9 的主要变化并进行测试。如果这没有帮助,请再次尝试从 1.9 到 1.10,依此类推。

关于javascript - 更新后 jQuery 自动完成组合框不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26790410/

相关文章:

javascript - Acrobat Reader 无法识别相对路径

java - comboBox 上的 Action 监听器以在 textField 中显示选择

mysql - 使用组合框和文本框进行搜索

javascript - gulp typescript 时出现 TypeError

javascript - Redux thunk 在下一个 Action 之前未解析 + then 不是函数或分派(dispatch)未定义

javascript - Bootstrap 3.0 : Trigger when content moved under a with fix nav bar

jquery - 如何更改数据表的语言

c# - UWP/C# 如何将 Comboboxitem 选择保存为 Sqlite 中的字符串

javascript - 根网址javascript

javascript - 通过为 Blogger 添加查询字符串来更改 Canonical Href?以及使用 JavaScript 或 jQuery?