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!

2 Answers 2


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...

  • 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, 2011 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, 2011 at 16:42

To maintain the content of the file for all your pages is easy. Save your HTML to your desktop. Open SharePoint Designer, click the "All Files" icon under Site Objects. In the All Files ribbon, under the Manage section, click "Import Files", locate the HTML file on your desktop and import. Right click your file and click Properties - copy the path you see in Location. Go back to your site page using your CEWP and paste the path in the URL box. Apply. Ok.

Now your HTML file is on your site page. Repeat this on all of your applicable pages.

When the time comes to change the content in the HTML, just open SP Designer and edit your HTML file. The changes will flow to all pages that use it.

  • 1
    This is not an answer to the OP's question, but rather you're answering a comment on another answer.
    – Erin L
    Aug 25, 2016 at 22:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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