2

I used jQuery many times in noconflict mode as below

var $j = jQuery.noConflict();

and it works great every time.

Today, I used the jQuery 'before after' plugin. I used the same noconflict function but it did not work http://www.catchmyfame.com/2009/06/25/jquery-beforeafter-plugin/

I am not sure that $.fn.extend works with no conflict or not. Please help thanks

Book Of Zeus
  • 49,509
  • 18
  • 174
  • 171
webkul
  • 2,836
  • 10
  • 47
  • 61

1 Answers1

2

Well, $.fn.extend will not work if it is within your code. You'll need to use $j.fn.extend for your code (if $j is the name of the variable that you are using for jQuery).

Plugins should work as they normally adopt the following convention,

(function($){ 
    /*Plugin Code*/
})(jQuery); 

which allows the use of $ whilst guaranteeing no conflict.

(See my answer here: What does this JavaScript/jQuery syntax mean?)

I would check your plugin to see if this holds true.

Hope this helps

Community
  • 1
  • 1
James Wiseman
  • 29,946
  • 17
  • 95
  • 158
  • The plug-in he linked does use aliasing and appears correct at first glance. – Nick Craver Feb 23 '10 at 11:39
  • Thanks James Wiseman i am using jquery UI as well in this plug-in and found there is some problem with jqueryUI http://dev.jquery.com/ticket/1686 . still things are not working :( – webkul Feb 23 '10 at 11:42
  • That link suggests the problem si fixed. What version of jQuery are you using? – James Wiseman Feb 23 '10 at 13:14