JQuery Integration with Sharepoint

JQuery changed the way we write javascript and easy to use.So JQuery become a must have for most of the developers around the world. We all are start working with sharepoint 2010 so one of the intresting question around the sharepoint world is Did Sharepoint 2010 ships with JQuery?. I was also curious about it so I was searching in the 14 hive folder in 2010 but there is no luck.So final answer to the JQuery Integration will be No Its not part of the Sharepoint 2010.

So it will be interesting to see how we could use JQuery in Sharepoint. Now JQuery could be used in two different way.

1. CDN Hosted JQuery

A number of large enterprises provide hosted copies of jQuery on existing CDN networks that are available for public use.


http://code.jquery.com/jquery-1.5.1.min.js Minified version

http://code.jquery.com/jquery-1.5.1.js Source version


Read More


2. JQuery from Local Server


Next approach will be download JQuery from the official site and save in your local server , then refer like any other JS file.


How to use in a Sharepoint page?

Download the JQuery jquery-1.4.4.min.js and copy to the layout folder (c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS) in 14 hive (12 hive for sharepoint 2007) .Now we are good to use JQuery in any of the Pages in any site collection.

1. Add the sharepoint script link in the content Place holder PlaceHolderAdditionalPageHead 
<
asp:Content contentplaceholderid="PlaceHolderAdditionalPageHead" runat="server">

 
        <
SharePoint:ScriptLink language="javascript" name="jquery-1.5.1.min.js" 
        runat
="server" localizable="false" />


</
asp:Content>

when you set localizable="false" it will pick from Layout folder otherwise from language folders like 1033 



2. Add the sharepoint script link in html head section of the master page


  <head    runat="server" >   
<SharePoint:ScriptLink language="javascript" name="jquery-1.5.1.min.js" 
        runat
="server" localizable="false" />
</head  >



Ebook Download
View all
Learn
View all