SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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.

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=""; 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

Your Answer


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.