On fast few days, I was working on site of my employer and I’m using different kind of jQuery plugin and custom jQuery code for different site part functionality and unfortunately I’m getting jQuery error “Uncaught Reference Error: jQuery is not defined” okay so the error seems easy right? All we need to do is just include the main jQuery library which we can find anywhere in the web in Google CDN, Microsoft CDN, jQuery CDN or hosted in your own server.
Okay now the error is gone but I found another errors in other jQuery file in custom jQuery and jQuery plugin, that says “Uncaught Reference Error: $ is not defined” and “Uncaught TypeError: Property ‘$’ of Object[object DOMWindow] is not a function“, so I begun debugging it myself and the safest way to solve and rid this problem is to use jQueryconflict, in your custom code or plugin jQuery file just copy the format in the code below.
JavaScript
1
2
3
4
5
|
var rys = jQuery.noConflict(); //create different alias
rys(“document”).ready(function(){
// Do something with jQuery
rys(“div p”).hide();
});
|
Note:
You need to replace all default “$” variable to your new variable in our case “rys”.
0 comments:
Post a Comment