0

I'm working on a SharePoint Online Plan 1 Site Collection in preparation for our Office 365 deployment and I'm getting a lot of requests for small UI changes and tweaks (make certain Library Columns bold, change the way the Announcements Web Part looks, etc.)

Ultimately it sounds like having jQuery available will help me address some of these requests. I'm not a Javascript whiz but I feel comfortable enough working with it (and who doesn't love a little jQuery now and then?)

Long story short I'm not finding any clear, easy way to make jQuery available via my Master Page (is that a sensible strategy? Using SharePoint ScriptLink?)

I've got SharePoint Designer all set up and have been messing around with it for a while but not having any luck getting this figured out from scouring the Internet.

Thanks!

2
  • You need to add jquery to your masterpage?
    – Keerthi
    Jun 24, 2015 at 18:12
  • I... I think so? I'm looking to make jQuery available on all of the pages in the site. I have jQuery in /_catalogs/masterpage/jQuery-1.11.3.min.js Jun 24, 2015 at 18:14

2 Answers 2

3

It worked! Thank you for your help @Keerthi! For future confused individuals like myself this is what worked:

With the jQuery library in the Site Assets library I created a new Script Editor web part with the following snippet:

<script src="/SiteAssets/jQuery.1.11.3.min.js" type="text/javascript"></script>

**alternatively you can replace the line above with this line to get jQuery via CDN**
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>


<script>
YOUR JQUERY HERE
</script>
0

You can add a javascript file using the content web part.

Edit page -> Add web part -> Media and content -> Content editor -> Add

Edit the source of the web part and add the following code into it:

​<script src="/sites/subsite/list/SiteAssets/file.js" type="text/javascript"></script><script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>

Add the js file under Site Assets using SharePoint Designer.

4
  • Shouldn't I be using the Script Editor web part? Jun 24, 2015 at 18:21
  • In my case, I had some issues using it. You can also try with that
    – Keerthi
    Jun 24, 2015 at 18:23
  • Do I need both of the script lines? I just tried this: ​<script src="/SiteAssets/jQuery-1.11.3.min.js" type="text/javascript"> blahblah my jQuery code </script> ... which didn't work Jun 24, 2015 at 18:25
  • You are completely wrong. One script tag is used to include the Jquery library and the other is your actual Javascript file.
    – Keerthi
    Jun 24, 2015 at 18:29

Your Answer

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

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