I have inserted some JavaScript into a Script Web Part. Just a button that adds some columns to a SharePoint list.

It works when I click the preview button on the Insert Snippet/Embed page. It works when I click Insert Snippet and get back to edit on the SharePoint page. But when I save the page, it stops working.

Any ideas?

(SharePoint Online 2013)

1 Answer 1


Never used SharePoint Online 2013 but try placing your Javascript code in the body section of the web part instead of the header section. On Sharepoint 2010, I had an issue where my Javascript wouldn't run as a webpart but it worked after I moved the Javascript code from header to body.


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.