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.

Share:
Share on Facebook0

Share on LinkedIn0Tweet about this on TwitterShare on Google+1Buffer this pageDigg thisShare on Reddit0

Comments (1)

  1. Perfectly worked for me. Thankyou Bhumi

Leave a Reply

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

Most Popular Posts

How To Store Binary Data in PHP

Posted on 4 years ago

Bhumi

What Are WordPress Nonces?

Posted on 1 year ago

Bhumi

Top 10 JavaScript Charting Libraries

Posted on 1 year ago

Bhumi