jQuery not loading (Uncaught ReferenceError: $ is not defined)

Posted on 2012-09-14
Medium Priority
Last Modified: 2012-09-15
I am using Flexislider to showcase products in my Magento store. Everything was working fine then it just Stopped showing on the hompage.

Using the Chrome inspector I have identified the following errors but have not idea how to fix as I am very new to jQuery and Magento. I am also using a callapsable menu which has also failed to load...

I really hope someone can help me PLEASE!!!

Uncaught ReferenceError: $ is not defined

Uncaught TypeError: Object [object Window] has no method 'load' :

Uncaught TypeError: Object [object Object] has no method 'mobileMenu'

Uncaught TypeError: Object [object Object] has no method 'flexslider'
Question by:rafique12

Expert Comment

ID: 38400744
The '$ is not defined' means jquery is not 'running'.

Check your script include for JQuery.

If you are using Google's CDN it could/should look like this:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js" type="javascript"></script> 

Open in new window


Author Comment

ID: 38400753
Thanks for the response, I have jquery-1.7.2.min.js being called in the header of my site. There are three other elements on the page that rely on jQuery which are working its just the product slider and mobile menu...

LVL 45

Accepted Solution

Chris Stanyon earned 2000 total points
ID: 38400816
By default, Magento uses the Prototype library which also hooks the $ sign for it's own use. You will need to call the noConflict() function of jQuery, and then in your jQuery functions, use jQuery instead of $. Some of this may already have been taken care of in your other jQuery scripts.

Something like this:

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
     jQuery(document).ready(function($) {
          //now you're inside the ready function you can use the $ for the jQuery object 
          var myValue = $('#someElement').val(); //normal jQuery stuff.

     //if you use the $ outside of the jQuery it will refer to your other library, not jQuery.

Open in new window

Do a search for jQuery in Magento for more info...

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question