What is noConflict() method in jQuery?
This is very important to differentiate scripts when we are using many JavaScript framework in our project.As we know jQuery uses dollar symbol ($) as shortcut.
There are many other popular frameworks are there as Angular JS, Knockout JS, Kendo JS, Backbone JS,Ember ,Vue etc.
Suppose i one of these frameworks is using the $ symbol as shortcut then one of the scripts either jQuery or othe framework implemented parallel may stop working.
noConflict is a method to avoid such situation in script.
We can create our self defined symbol or string as shortcut for jQuery. noConflict() return a reference and we can store this reference in a variable.
Example of noConflict() and self defined shortcut:
var jq = $.noConflict(); jq(document).ready(function(){ jq("button").click(function(){ jq("p").text("Hi there,Conflict resolved"); }); });