Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm new to SharePoint. We have 2010. I want to use jQuery on a single page, not the entire site. What's the best way to do this? Can it be done without modifying the master page? Thanks!

share|improve this question
add comment

1 Answer 1

You can either use a CEWP (Content Editor Web Part) or a HTML Form Web Part. The best way is to create a script file that contains the code from the link below.

http://sympmarc.com/2011/05/03/adding-jquery-to-a-sharepoint-page-step-one-always/

Once you've created your .js file, upload this file to a document library. Use a CEWP and point the Content Link to the URL where you've uploaded your .js file. That's really all it'll take, but if you have questions, feel free...

share|improve this answer
    
Hey cool, that worked! Awesome, thanks!! –  Rich Uchytil Oct 7 '11 at 15:29
    
Instead of uploading, you can also write code within the source editor (which you can access through "Format Text" tab of Editing Tools, "Edit HTML source" option available through HTML button within "Markup" section of Ribbon) of the Content Editor Web Part, to get a reference to the jQuery library that's on Google or Microsoft's CDN (there are performance benefits): <script src="ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"; type="text/javascript"></script><script type="text/javascript"> $(document).ready(function(){ //your code goes here }); });</script> –  mvark Nov 24 '11 at 9:11
    
What's the best way to maintain your code if it's typed directly within a CEWP? What if you have thousands of pages? –  iOnline247 Nov 26 '11 at 16:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.