$.browser is undefined error [duplicate]
Asked Answered
S

1

61

Possible Duplicate:
Is jQuery $.browser Deprecated?
jQuery latest $.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.

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: Link What is the cause of this and how do I resolve this?

Shainashaine answered 25/1, 2013 at 14:53 Comment(2)
"What is the cause of this and how do I resolve this?" jQuery 1.9 is the cause, since $.browser was removed in this version. Either use an older version or don't use $.browser, respectively, don't use a plugin that uses it. Have a look at the documentation: api.jquery.com/jQuery.browser.Dynah
possible duplicate: https://mcmap.net/q/324236/-jquery-browser-javascript-uncaught-typeerror/1249581.Burnejones
D
106

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

Delanos answered 25/1, 2013 at 14:56 Comment(2)
so what will be the solution for this?Pro
Use github.com/jquery/jquery-migrate/#readme This will restore deprecated functions.Nonentity

© 2022 - 2024 — McMap. All rights reserved.