jQuery and Wordpress: Using noConflict
Welcome! Thank you for visiting!
Please Subscribe to my full feed.
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) {
event.preventDefault();
$j("#box").slideToggle();
});
});
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!
Related Posts:


