JQuery conflict with SharePoint 2010 JavaScript Libraries

 

I have lost nearly a day to fix the JQuery not run in SharePoint site.

It’s really strange that there is only 1 page in the site that JQuery could not run. And It’s very hard to figure out what is the problem.

No I found it, the JQuery library conflict with SP.js of SharePoint 2010. We shoud change the code like this:

var $j = jQuery.noConflict();

// Use jQuery via $j(...)
$j(document).ready(function () {
$j(".someclass").hide();
});



So, in the above code, we actually referring the $j() instead of directly $(), so it won't give any problems in future. No matter what how many different client side javascript technologies used, that should work.



Please go here for more information: http://docs.jquery.com/Using_jQuery_with_Other_Libraries

Comments

Popular posts from this blog

Setup SharePoint 2010

Register CSS to SP Master Page