简体   繁体   English

使用IE7的Jquery:对象不支持属性或方法?

[英]Jquery with IE7 : Object doesn't support property or method?

I'm using Jquery 1.8.2 with IE7 (my clients need it T_T) I created my own function like this 我正在使用Jquery 1.8.2和IE7(我的客户需要它T_T)我创建了我自己的这样的功能

(function($)
{
    $.fn.suggestionBox = function(options)
    { 
       ............
       ...........
    };
})(jQuery);

And when I call it I get error : Object doesn't support property or method 'suggestionBox' 当我调用它时,我得到错误: 对象不支持属性或方法'suggestionBox'

<script>    
$(document).ready(function() {

        $('input[name="myBox"]').suggestionBox({'ajaxUrl' : 'mySuggestions.do', 'targetInputBoxSelector' : 'input[name="myObjName"]'});


});
</script>

Anyways, it works on Chrome and IE8-9. 无论如何,它适用于Chrome和IE8-9。 Any ideas? 有任何想法吗?

I finally found that the issue is from having excessive comma on the last element in array. 我终于发现问题来自于数组中最后一个元素的逗号过多。 While modern browsers can ignore it, IE7 doesn't. 虽然现代浏览器可以忽略它,但IE7却没有。

{A,B,C,}

Changing it to {A,B,C} fix this problem. 将其更改为{A,B,C}可解决此问题。

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

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