View Full Version : jQuery jQuery.noConflict Issue

10-31-2010, 06:13 PM

I'm having a jQuery conflict issue I'm unclear how to resolve. The problem is I've added some jQuery vertical tab code to one of my pages that's conflicting with one of my Wordpress plugins. I realize folks may not be familiar with Wordpress, but I think my issue is less to do with the blog than a conflict with jQuery.

The plugin in question is WP-Lightbox 2. It references the WP installation (/wp-includes/js/jquery) of jQuery. The last line of that file contains "jquery.noconflict;". When I remove this line, Lightbox 2 stops working - but my vertical tab code works. Add it back and Lightbox works, but my code doesn't. I've tried "$j=jquery.noConflict;" but that doesn't work either.

So, my question is - what exactly does this line do and are there any alternatives I can use? Here's my vertical tab code:

<script type="text/javascript">
$(function() {
var $items = $('#vtab>ul>li');
$items.mouseover(function() {

var index = $items.index($(this));

11-01-2010, 02:23 PM
Have a look here (http://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_wrappers) for what I suspect is the issue.

11-06-2010, 07:52 PM
Awesome job, thanks that worked!!