jQuery $.browser 是未定义的错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14524289/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 13:40:39  来源:igfitidea点击:

$.browser is undefined error

jqueryjquery-uijquery-1.9

提问by Anders Branderud

Possible Duplicate:
Is jQuery $.browser Deprecated?
jQuery latest $.browser

可能的重复:
不推荐使用 jQuery $.browser 吗?
jQuery 最新的 $.browser

In a code I am using JQuery is loading. I have gone through all the files that should be loaded, but I can't find where JQuery is loaded. I need to include a second JQuery-script in order that a file which I include should work properly, since the first script is loading to late. However, this leads to other errors, since definitions are overwritten when the first JQuery-file is loading (the one I haven't declared). So now I am trying to use jQuery.noConflict in order to fix this.

在我使用 JQuery 加载的代码中。我已经浏览了所有应该加载的文件,但是我找不到加载 JQuery 的位置。我需要包含第二个 JQuery 脚本,以便我包含的文件正常工作,因为第一个脚本加载到很晚。但是,这会导致其他错误,因为在加载第一个 JQuery 文件(我尚未声明的文件)时会覆盖定义。所以现在我试图使用 jQuery.noConflict 来解决这个问题。

Here are some example of usages in my code:

以下是我的代码中的一些用法示例:

<script>
var $jquery190 = jQuery.noConflict();
</script>


jQuery.noConflict();
    (function($) {
//$(function() {
// more code using $ as alias to jQuery
//});
 $.fn.setupSpinner = function () {
        $(this)
            .ajaxStart(function () {
                $(this).show();
            })
            .ajaxStop(function () {
                $(this).hide();
            })
        ;
        return this;
    };


})(jQuery);


$jquery190(config.ids.datepicker + ", " + config.ids.todatepicker).datepicker("disable");
$jquery190(config.ids.datepicker + ", " + config.ids.todatepicker).datepicker("setDate", "-2d");
$jquery190(config.ids.datepicker + ", " + config.ids.todatepicker).datepicker("enable");
//        $(config.ids.datepicker + ", " + config.ids.todatepicker).datepicker("hide");

After doing some of these replacements I get the error:

完成其中一些替换后,我收到错误消息:

TypeError: $.browser is undefined
[Break On This Error]   

...= buttonPanel + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.i...

The website is found here: LinkWhat is the cause of this and how do I resolve this?

该网站位于此处:链接这是什么原因造成的,我该如何解决?

回答by Tim

The .browser call has been removed in jquery 1.9 have a look at http://jquery.com/upgrade-guide/1.9/for more details.

.browser 调用已在 jquery 1.9 中删除,请查看http://jquery.com/upgrade-guide/1.9/了解更多详细信息。