Today, when i try to create a Wordpress plugin with some jQuery effects, and find out the jQuery is not working properly in Wordpress?
Since Wordpress version 2.x, jQuery is a build-in Javascript library, explicitly include the jQuery library into Wordpress is not necessary.
Problem
jQuery is not working in Wordpress plugin writing?
When you try to test a simple jQuery effect like following
$(document).ready(function(){ alert('test'); });
It’s just not working, no alert message box pop up. When i copy this example to a simple HTML file, it working as expected. What’s the heck? Is there any interoperability issues between jQuery and Wordpress?
After googling about jQuery and Wordpress, i started to understand the reason behind it. In Wordpress, $() is reserved for the Prototype library usage, we should use jQuery() to accomplish any jQuery task.
I made some changes …
jQuery(document).ready(function(){ alert('test'); });
Alternative you can use noConflict() …
$j=jQuery.noConflict(); // Use jQuery via $j(...) $j(document).ready(function(){ alert('test'); });
Please visit here for more detail about jQuery.noConflict();
http://wordpress.org/support/topic/141394
Solution
Never use jQuery handy function $() in Wordpress plugin writing. You have to use jQuery() or jQuery.noConflict() to work between jQuery and Wordpress.



Thanks for the heads up – had me confused for a bit. They really should change that since jQuery is fast becoming the defacto standard for js frameworks.
Good to see this. But jquery at front end is different from backend.
thanks for the info. I am having problem with wordpress theme and it cant display sidebar and my tweets. it says “jQuery is disabled and this widget needs it” how do i fix it? please help
Thanks for this helpful post. I’m having some issues with jQuery on my site. Basically, I can’t get jScrollPane (custom scrollbars) to work as it’s not recognizing Wordpress’ built-in jQuery library. Do you think you can take a look and see where I went wrong? I’m thinking I need to use noConflict() but I’m not entirely sure. I would really appreciate some help! Here is the specific page: Page
Thanks! My jquery works now. Will this work until another plugin uses $j = jQuery.noConflict() and assigns $j? Also, any idea how to include a newer version of jquery? It looks like the default version with my WP is kind of old.
Thank you for shedding some light on this. I was wondering why a basic line like alert($(“contact_form”)); was giving me an “Object not supported” error. Strangely it was only having this problem in IE.
IE and Mozilla browser implementation is very different, may be you can give me full example here or by email, so that i can dig it in detail