Home >Tips > SharePoint Online from Scratch > Content Editor with JavaScript Link kalmstrom.com site map icon Site map  

Add a JavaScript Link to a Content Editor Web Part

A SharePoint Online tutorial by Peter Kalmström

SharePoint iconIn an earlier demo Peter Kalmström, CEO and Systems Designer of kalmstrom.com Business Solutions, showed how to add a link in the Content Editor web part to a text file containing the CSS code in the Site Assets library, instead of adding the CSS code to the HTML source of the web part.

This "link to CSS" method is quicker to change, as you don't have to open the page in edit mode and then open the source. Instead you can make the change directly in the CSS file.

You can do the same thing with a JavaScript code. Instead of adding the JavaScript snippet to the HTML source of the Content Editor web part, as described in the previous demo, you can enter the code in a .js or .htm file and save it to the Site Assets. Then you can just add a link in the Content Editor web part.
  1. Add the JavaScript snippet to a .js or .htm file and upload it to the Site Assets library.
  2. Add a Content Editor web part to the page.
  3. Edit the web part and type the path to the JavaScript file.
  4. Apply and save the page.

Follow kalmstrom.com on LinkedInFacebook or Twitter!

back icon next icon

Products Buy FAQ Services Tips Books Contact About Us Tools

Security and integrity

Copyright  Kalmstrom Enterprises AB  All rights reserved