If you are using another JavaScript library that uses the $ variable, you can run into conflicts with jQuery. In order to avoid these conflicts, you need to put jQuery in no-conflict mode immediately after it is loaded onto the page and before you attempt to use jQuery in your page.
Method 1:
When you put jQuery into no-conflict mode, you have the option of assigning a variable name to replace $. ( only once )
<script src="prototype.js"></script>
<script src="jquery.js"></script>
<script>var $j = jQuery.noConflict();</script>
Method 2
You can continue to use the standard $ by wrapping your code in a
self-executing anonymous function; this is a standard pattern for
plugin authoring, where the author cannot know whether another library
will have taken over the $.
<script src="jquery.js"></script>
<script>
jQuery.noConflict();
(function($) {
// your code here, using the $
})(jQuery);
</script>
Method 3:
use jQuery instead of $
there few other ways to do so
reference
noConflict()is for jQuery to get along with other possible libraries that make use of$variable (for example Prototype is such library). So if you often work with two conflicting libraries on one page, you have to get used to usingjQuery.noConflict.jQuery.noConflicts(), may b in header.jQuery.noConflictonce somewhere after embedding jQuery into to page, and then, instead of dollar sign variable ($) refer to jQuery by using variable you have assigned it to (j$in your example).