jQuery UI自动完成功能在Firefox中有效,但在IE中无效 [英] jQuery UI autocomplete works in Firefox but not in IE

查看:132
本文介绍了jQuery UI自动完成功能在Firefox中有效,但在IE中无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在jQuery UI 1.8rc3中有了新的自动完成小部件,在Firefox中效果很好.在IE中根本不起作用.有人可以帮我吗?

I've got the new autocomplete widget in jQuery UI 1.8rc3 working great in Firefox. It doesn't work at all in IE. Can someone help me out?

HTML:

<input type="text" id="ctrSearch" size="30">
<input type="hidden" id="ctrId">

Javascript:

$("#ctrSearch").autocomplete({
    source: "ctrSearch.do",
    minLength: 3,
    focus: function(event, ui){
        $('#ctrSearch').val(ui.item.ctrLastName + ", " + ui.item.ctrFirstName);
        return false;
    },
    select: function(event, ui){
        $('#ctrId').val(ui.item.ctrId);
        return false;
    }
});

结果(IE 8):

红色框是jQuery创建的<ul>元素.

The red box is the <ul> element created by jQuery.

我也收到此错误:

Line: 116
Error: Invalid argument.

当我在IE8脚本调试器中打开它时,它在jquery.min.js的第116行中突出显示f[b]=d.请注意,我正在使用Google服务器上托管的jQuery 1.4.2版本( https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js ).

When I open it in the IE8 script debugger, it highlights f[b]=d on line 116 of jquery.min.js. Note that I'm using version 1.4.2 of jQuery hosted on Google's servers (https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js).

我尝试删除一些选项,但是即使我不带任何选项或仅带源选项的.autocomplete()调用,我仍然会得到相同的结果.

I've tried removing some of the options, but even when I call .autocomplete() with no options, or with only the source option, I still get the same result.

再次,它可以在Firefox中运行,但不能在IE中运行.有什么建议吗?

Once again, it's working in Firefox, but not in IE. Any suggestions?

谢谢.

更新:如建议的那样,我使用了jquery.js(而不是jquery.min.js),并在第4618行出现了错误.请参见下面的抖动回答.请参阅其他堆栈溢出问题,是几天前发布的.

UPDATE: As suggested, I used jquery.js (instead of jquery.min.js) and got the error on line 4618. See jitter's answer below. Please see this other Stack Overflow question that was posted a few days ago.

更新2:我发现,当应该使用功能this.element.height()

UPDATE 2: I discovered that jQuery UI autocomplete uses an invalid property this.element.height, when it should be using the function this.element.height()

推荐答案

如果我理解的正确,您所指的行似乎是

If I understand this right the line you refer to seems to be the line 4618 in jquery.1.4.2.js in the style function. Which can only mean that the Autocompleter plugin tries to set a style value that IE8 doesn't understand or doesn't allow to be accessed/changed in this way.

style[ name ] = value; //style == elem.style from the passed in element

这篇关于jQuery UI自动完成功能在Firefox中有效,但在IE中无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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