What is jQuery.noConflict?

Answer Posted / chaitanya

As other client side libraries like MooTools, Prototype can be used with jQuery and they also use $() as their global function and to define variables. This situation creates conflict as $() is used by jQuery and other library as their global function. To overcome from such situations, jQuery has introduced jQuery.noConflict().

Hide Copy Code

jQuery.noConflict();

// Use jQuery via jQuery(...)

jQuery(document).ready(function(){

jQuery("div").hide();

});

You can also use your own specific character in the place of $ sign in jQuery.

Hide Copy Code

var $j = jQuery.noConflict();

// Use jQuery via jQuery(...)

$j(document).ready(function(){

$j("div").hide();

});

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to read, write and delete cookies in jquery?

437


Explain various methods to make ajax request in jquery? : jquery mobile

424


What is $() in jquery library?

462


How to search for descendant elements that match the specified selectors using ?

436


Why html 5 inputs look different across devices and browsers? : jquery mobile

415






What is .bind()? : jquery mobile

459


Why is only the first page of multi page document loaded? : jquery mobile

443


Mention the advantages of cdn? : jQuery Mobile

497


How can we show and hide an element via jquery?

449


How to get the server response from an ajax request using jquery?

459


Explain "beforesend(xhr)" paremeter of jquery ajax method?

405


How we can set the html contents of an element in jquery?

441


How can we include jQuery library in ASP.Net project?

466


What is the difference between prop() and attr() in jquery?

433


What is event preventdefault () and event stoppropagation () in jquery?

395