Data Haunting

Easy Solutions Destination


Jquery – $ is not defined

While working with Jquery or Javascript we have face many times error in our console that Jquery is not defined or $ is not defined or Uncaught ReferenceError : Jquery is not defined or ReferenceError: $ is not defined. In this article we will see the possible reasons for this Jquery error and proper solutions step by step so we can overcome from this Error.

Reasons and Solutions for Jquery – $ is not defined Error

There are plenty of reasons for this Jquery Error.

  1. Due to not proper Javascript or Jquery file loaded into our page

    First you have to check that your Javascript file is properly loaded in to your page or not. For that you have to also examine your browser console. .

  2. Make sure your Main Jquery or Javascript file is loaded first before any Jquery script run

    This one also can be headache sometime as you run you Jquery script before Jquery file is loaded. So Make sure you have put your Jquery file first before any Jquery Script is running.

  3. Proper order of Javascript or Jquery File

    Suppose if you have multiple Javascript or Jquery file than you to make sure that you have added Main Jquery or Javascript file before any Javascript file otherwise this will turn into Jquery Error $ or Jquery is not defined. Your Jquery file order must be like below.

  4. Make sure your all Javascript code run inside $(document).ready function

    You have to ensure that your Jquery code is loaded after your Jquery is initialized for that you have to put your javascript or Jquery script inside the $(document).ready(function (). So the chances of Error Jquery – $ is not defined is reduce.

    It is not necessary that all Javascript or Jquery code must be inside $(document).ready(function ()), if you have some event base action which is calling javascript function than you can write your Javascript function outside $(document).ready(function ()) also.

  5. Might be your CDN hosted Jquery is blocked or old

    Suppose if you using direct CDN jquery online path than check that your Jquery version is working properly or not. It can be old or might be blocked by google also.

  6. Compatibility issue of your Jquery or Javascript file if you have other Javascript Libraby

    This one also can possible if you are using other Javascript Library which is not compatible with your Main Jquery file version. So before adding any other Javascript Library check this criteria properly.

  7. Check proper Javascipt type=”text/javascript”

    Make sure you have added type=”text/javascript” properly without any spell mistake. This can also be create issue.

What is your opinion ?

Here we have discuss all possible reasons for Jquery – $ is not defined error. I hope it will be very useful to overcome from this Jquery error and you will enjoy it. If you have any query and question, you can comment or you can mail me.

Leave a Reply