ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Internet & the Web

How to use jQuery's .noConflict() functionality

Updated on August 12, 2009

About jQuery.noConflict();

jQuery is a great javascript library that makes your javascript development more interestin, exciting and effective. Most of us use jQuery without even knowing how it works or how to write jQuery code. We just take jQuery plugin and plug it in into our web pages. We go so crazy that we don't just plug in jQuery plugins, but also end up with MooTools, prototype.js plugins in our pages and that's probably when the problems start. All those plugins work perfect on their own but when you add another javascript framework plugin they start to conflict.

The good news is that jQuery made sure it does not conflict with other plugins. All you need to use is jQuery's .noConflict() method like this jQuery.noConflict(); before you write any jQuery code.

Example use

Here is an exaple of its use taken from jQuery.noConflict() post on jQuery blog:

  <script src="prototype.js"></script>
  <script src="jquery.js"></script>
    // Use jQuery via jQuery(...)
    // Use Prototype with $(...), etc.

When you call .noConflict() jQuery will return $() to it’s previous owner and you will need to use jQuery() instead of shorthand $() function.

You can also use the following code snippets to still use $() in your code, but with one drawback, you will not have access to your other library’s $() method.

// Method 1

// Method 2
(function($) {
    /* some code that uses $ */ 

TIP: Don’t forget that you can always assign jQuery to any other variable name to use it as your shorthand: var $_ = jQuery;


    0 of 8192 characters used
    Post Comment

    • profile image

      munna 3 years ago

      after using noconflict, if we add highcharts library dynamically it is giving object expected error.

      can you please tell me how to avoid this error.

    • profile image

      dasdada 5 years ago


    • profile image

      tj 5 years ago

      hye is page kinda old but isit still alive.cuz i need help :)

    • profile image

      gangeshvar 6 years ago

      Hi, I was wondering if you could help me with a conflict on my site.

      I have a menu that uses jQuery, and a script (LightView) running prototyp.

      Ive researched the conflict, and tried to understand how to fix it, but I'm pretty much lost.

      I don't know where to properly use .noConflict()

      Could you take a look at mysite and maybe suggest a solution?

      My email is squirrelslax[at]

      thank you

    • profile image

      Johnpantooo 6 years ago

      Hello Everyone,

      In JQuery generally ($) dollar sign is an indication of using JQuery function but jQuery give us functionality to rename ($) dollar sign instead of other user define variable name. By using noConflict () method.............. for more details please check out this link.

      Thanks !!!!!

    • profile image

      Darren 6 years ago

      Cheers, any help on this tho:

    • profile image

      Nipu 6 years ago

      Thanks for share this but i have a problem i am using mootools when i use jQuery.noConfilt() , my problem does not solve.

    • profile image

      Akhmad 6 years ago

      @MUHAMMAD SALMAN AND @Abdelkader Soudani

      I use "jQuery" to variable selector and it works, eg. $(document).ready(function(){






    • profile image

      Abdelkader Soudani 6 years ago

      Absolutely right! sometimes you get too excited implementing lots of Jquery functions and out of nowhere something makes conflict and oops... nothing works anymore!

      Thanks for the great post, very informative and straight forward, I've enjoyed it.

    • profile image

      MUHAMMAD SALMAN 7 years ago

      Hi , this is very informative

      But i have a problem i am using accordin library with yui when i use jQuery.noConfilt() , my problem does not remove

      plz help


    • hathibelagal profile image

      hathibelagal 8 years ago from A jungle inn

      Short.. but useful.