Tuesday, May 3, 2011

jQuery and SharePoint 2010 conflict

When you try to use jQuery with SharePoint 2010 you could get problems in some browser like IE. This is caused because of conflicts with the Microsoft JavaScript selector "$", which is the same variable as the jQuery selector.

To avoid conflicts you can easily use the noConflict method of jQuery and change the selector for jQuery.

 var $j = jQuery.noConflict();  
 $j(document).ready( function() {    
   $j("#content").addClass("...");  
 });  

For more information see jQuery.noConflict.

No comments: