jQuery and WordPress: Using noConflict

I have been using wordpress for a while and now I’m starting to integrate more jQuery into some of my blogs. Problem is I have been having problems with the code acting up. After searching I found the jQuery is now included in the core code for wordpress. More reading and I found that I need to use jQuery’s noConflict to make my code work in wordpress. Using noConflict your code will look like this:

$j = jQuery.noConflict();

$j(function() {
$j("#sidebar #trigger").click(function(event) {

Basically anywhere you would have used just the $ sign you add in a “j”. The variable name can be anything some examples use $js I just chose $j.

Please sign up for my feed as I will be adding more wordpress and jQuery goodness!

This entry was written by and posted on Tuesday, August 18th, 2009 and is filed under wordpress.
Follow any responses to this entry through the RSS 2.0 feed.

3 thoughts on “jQuery and WordPress: Using noConflict

Comments are closed.