1

I want to add some global JavaScript to Sharepoint 2010. So I put JQuery to C:\Program Files\Common Files\microsoft shared\Web Server Extensions\14\TEMPLATE\LAYOUTS and my script to C:\Program Files\Common Files\microsoft shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\Scripts\ and now I have no clue where to put <script src="/_layouts/jquery-min.js"> Can anyone help with this?

Thank you

2 Answers 2

6

You can put <script type="text/javascript" src="/_layouts/Scripts/jquery-min.js"></script> in master page to access this javascript globally in all pages.

Or you can put that script tag in your custom webpart / content editor webpart / script editor webpart to access that script only for that webpart only.

3
  • I have three of master pages: default.master, minimal.master and v4.master. Changing any of them doesn't affect anything, i.e. I don't see my changes in default page source
    – sotona
    Commented May 16, 2016 at 12:10
  • Add this script tag in your current master page. By putting this script, Which functionality you want to achieve? Commented May 16, 2016 at 12:12
  • so putting this globally doesn't change anything. you should change master pages for each subsite
    – sotona
    Commented May 16, 2016 at 13:26
0

I discuss how to get started with jQuery (including how to deploy and reference the library) in this conference session: JavaScript and jQuery for SharePoint Developers

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.