Manish Pansiniya's Blog

.NET, C#, Javascript, ASP.NET and lots more…:)

$ is not defined error – jQuery error

with 14 comments

I was working with jQuery for the menu and got the error “$ is not defined”. And after finding it through firebug, it was the bug due to jQuery.js file included after javascript code.

So if you include the jQuery.js file, first before any of the jquery script, this will go away…


Written by Manish

January 16, 2010 at 3:46 pm

Posted in .NET, .NET 3.0

Tagged with , ,

14 Responses

Subscribe to comments with RSS.

  1. good catch:)

    Vijay Modi

    January 19, 2010 at 7:24 pm

  2. i have done all this.but its not working for me


    April 22, 2010 at 9:18 am

    • Could you please paste your code here?



      April 22, 2010 at 10:22 am

  3. hi all!

    I already have solved the problem. ok, let say I put my master page on :
    [Project folder]/App_Modules/master/main.master
    and I put my js files on :
    [Project folder]/App_Modules/js/jquery-1.2.2.pack.js.js

    when I tried to call the file in my main.master file first I used to think that in based on masterpage file location so I make it :

    but It was wrong, because I should be based on page who used the masterpage file. so I changed it into :

    since my file Default.aspx putted at the same level App_Module folder.

    good luck 🙂


    June 22, 2010 at 3:46 pm

  4. i tried al d ways to solve the $ not defined problem.
    but no use.
    can any1 help me.


    March 19, 2011 at 6:02 pm

    • Could you post more details here…


      March 19, 2011 at 6:12 pm

  5. Hi all,

    I fixed the plugin to force my .js to append after the jquery call, but still have the same $ is not defined error. I used a testing site on my server, here is the source from the headers:

    here is the PHP call:

    if ( !is_admin() ) { // instruction to only load if it is not the admin area
    // register your script location, dependencies and version
    wp_register_script(‘wp_MyScript_js’, WP_PLUGIN_URL.’/’.str_replace(basename( __FILE__),””,plugin_basename(__FILE__)) . ‘script.js’, array(‘jquery’),’1.0′);
    // enqueue the script

    I appreciate any thoughts and thanks ahead of time!


    April 7, 2011 at 2:06 am

    • Not sure how I overlooked this but here is the solution. The jQuery library loads in “no conflict” mode. So, wrap your js codes as noted below.

      from web page

      jQuery(document).ready(function($) {
      // $() will work as an alias for jQuery() inside of this function
      // Your codes go here


      April 7, 2011 at 4:21 am

  6. //index.php

    $(document).ready(function() {

    $(‘#username_input’).keyup(function() {
    $.post(‘check.php’,{ username: form.username.value },
    function (result) {





    December 5, 2011 at 7:56 pm

  7. I am getting $ is not defined
    $(document).ready(function() {


    December 5, 2011 at 7:58 pm

  8. Good post but I noticed that there are various reasons for this error. I found a good post which have listed all possible reasons of this error. Thought of sharing with you.

    Virendra Dugar

    March 26, 2012 at 11:21 am

  9. i got error in $ is not defined as the code $.ajax({

    saravana kumar

    April 4, 2012 at 6:27 pm

  10. Howdy! I just wish to give an enormous thumbs up for the great information you will have here on this post.
    I will probably be coming again to your blog for
    extra soon.


    July 26, 2013 at 3:44 am

  11. It’s really a great and helpful piece of information.

    I’m happy that you just shared this helpful information with us.

    Please keep us up to date like this. Thanks for

    December 21, 2013 at 6:52 am

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: