Back to Top

Solution: Uncaught ReferenceError $ is not defined in WordPress

Uncaught ReferenceError: $ is not defined in Wordpress

As you all know, new version of WordPress (3.5) includes its own version of jQuery, which has been rigorously tested with WP and many of the most common plugins in order to provide the best compatibility and experience for WordPress users.

So When I have added my jQuery code into my theme, I got the following error

I was surprised with this error generated into the console but after that I just checked jQuery by viewing source and got the solution

Keep in mind: Offloading the default jQuery and other scripts to Google is similarly disallowed. If your code doesn’t work with the built-in jQuery, it’s most likely a no conflict issue. If you can’t, we need to know why so we can fix things for everyone.

Solution:

Well, there’re a few problems with jQuery code.However, the main reason I am getting jQuery issues is that I need to put jQuery no-conflict wrappers around the code

I need to add

to the top of code, and add this:

To the bottom. This allows the $ character to be defined as the jQuery object.

That’s it.You are done.!! 🙂

Hope this post will helpful for you, waiting for your responses.Thanks for reading and feel free to share your thoughts! Don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.

Comments (1)

  1. Perfectly worked for me. Thankyou Bhumi

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Most Popular Posts

How to use HTML5 download attribute?

Posted on 9 years ago

Bhumi

How to move Modx site to Live server

Posted on 12 years ago

Bhumi