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
Uncaught ReferenceError: $ is not defined
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.
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.