1

I need to add a JavaScript widget to a SharePoint Page. The Widget is basically a popup. How can I achieve this?

1

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

You can do this by

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.

0

The best approach would be to use a Content Editor Web Part or a Script Editor Web Part. You can achieve this by going to your page, Edit Page, Add Web Part and select the Content Editor Web Part. Inside the Content Editor web part click on View Source in the ribbon and paste in your JS script in there.

Another great approach is to put your plugin into a .txt file and save it in your Site Assets library. Add the Content Web Part and open the Properties for it. Inside of the properties you can paste the path to .txt file with your plugin.

If you can post the script on here for reference, I can show you a visual example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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