How can we help you today?

How to Add JavaScript Code to a Page Using the Script Editor Web Part

You have an HTML, JavaScript or CSS snippet that you want to inject into the page, without having it been cleaned out by the SharePoint editor?

Well, this article is for you, so let's start.


TABLE OF CONTENTS


Step 1: Add the Script Editor Web Part


From ribbon bar, click Web Part (you can add it anywhere on the page, it does not matter, as it will not render anything):



Under Categories, choose Media and Content > Script Editor and click Add:




Step 2: Edit the Web Part


Activate the Web Part by clicking it, then a new tab Web Part in the ribbon will appear:



Then next, click the Web Part Properties button:



Step 3: Add the Code into the Web Part


The page will refresh, and the Script Editor Web Part will appear now in edit mode, click on Edit Snippet, to bring up the dialog that will allow you to paste some JavaScript code into the page.



Now you can paste whatever HTML code you have into the Embed dialog:




Please note, that script tags are required when adding custom JavaScript to your Sharepoint Site:




Related articles:

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.

World's best intranet sites are designed using ShortPoint

Get started today! Learn more
See all 23 topics

Start a trial

Ignite your vision. Install ShortPoint directly on your site, or play in sandbox mode. No credit card required.

Get started today

World’s best intranet sites are designed using ShortPoint

Thousands of companies using ShortPoint everyday to design, brand and build award winning intranet sites.

Get started Learn more