What is jQuery.noConflict?



What is jQuery.noConflict?..

Answer / 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

More jQuery Interview Questions

How to add or remove classes to an element in jquery?

0 Answers  


What is the difference between event.PreventDefault and "return false"?

1 Answers  


What is the use of queue() in jquery?

0 Answers  


How you get server response from an ajax request using jquery?

0 Answers  


Tell me how to select combobox select value and text using jquery?

0 Answers  






How to disable cut,copy and paste in TextBox using jQuery?

0 Answers  


How to write cookies in jquery?

0 Answers  


What is difference between sorting string array and sorting numerical array in jquery?

0 Answers  


How do you update ajax response with id " resilts"?

0 Answers  


Is vanilla js faster than jquery?

0 Answers  


What is cdn and how jquery is related to it?

0 Answers  


What are two different version of jquery library? : jquery mobile

0 Answers  


Categories