Uncaught Reference Error: jQuery is not defined
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 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 jQuery conflict, in your custom code or plugin jQuery file just copy the format in the code below.
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
To find more information about jQuery conflict visit their site at jQuery.com.