We know that jquery uses $ a shortcut of Jquery.there are many frameworks of javascript Like Angular,Backbone, Ember and more .Each Framework use a shortcut but if two different frameworks use same shortcut. Then one of them might stop working.That why Jquery team implement noCoflict() Method.
noConflict() end the hold of Jqeury on $ and we use jquery instead of $ and other framwork can use $. With noConflict() we can easily create our own shortcut.For example
var jq = $.noConflict();
jq(document).ready(function(){
jq("button").click(function(){
jq("p").text("jQuery is still working!");
});
});
If you have a block of jquery code with $ shortcut and we donot want to change it. Then we pass $ as a parameter to the ready Method. This Will allow you to use $ inside the function and Outside we use jquery.
$.noConflict();
jQuery(document).ready(function($){
$("button").click(function(){
$("p").text("jQuery is still working!");
});
});
Difference between Jquery and $
$ and jquery both are same .But $ is just an shortcut of Jquery and it can be change .Mostly we change it if we use any other javascript framework. Because many javascript use $ as a shortcut then if we use $ for jquery and also $ for other framworks then one will work and other do not work.