How to include javascript code using Sharepoint designer 2013 in sharepoint online classic community site Form?

Audi86 731 Reputation points
2022-07-14T13:38:55.557+00:00

hi,

I have a javascript code to edit form in community site using sharepoint designer. I have tested the code in chrome dev console to verify it is working but when i am uploading it style library and updating tag on master page using SP designer. i dont see any response. Attached is the working javascript code, is there any specific way to modify the code to run with .aspx file?

220698-image.png
Thanks
220803-script.txt

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,680 questions
{count} votes

3 answers

Sort by: Most helpful
  1. RaytheonXie_MSFT 31,526 Reputation points Microsoft Vendor
    2022-07-15T07:28:55.31+00:00

    Hi @Audi86 ,
    You can follow the document to insert your js code to edit form.
    https://social.technet.microsoft.com/wiki/contents/articles/23955.sharepoint-2013-building-custom-forms.aspx

    I would recommend you to upload js file to Site Assets library. Refer the file from Site Assets or any other library. Make sure this link it not blocked by SharePoint or your network. Then add a Content Editor or Script Editor web part for inserting the code.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


    1 person found this answer helpful.

  2. Rijwan Ansari 746 Reputation points MVP
    2022-07-15T10:06:03.663+00:00

    HI @Audi86

    If you want to add JavaScript only, then you can use a Content Editor web part to the page. Without using SharePoint Designer, you can add Js in your page as well.

    1. Add a Content Editor web part to the page.
    2. (Click on the link to add new content, if you are using a web part page.)
    3. Click on the Edit Source button in the ribbon.
    4. Paste your JavaScript code in the HTML source.
    5. Apply and save the page.

    https://www.kalmstrom.com/Tips/SharePoint-Online-Course/Content-Editor-JavaScript.htm

    1 person found this answer helpful.

  3. Rijwan Ansari 746 Reputation points MVP
    2022-07-15T10:23:33.033+00:00

    Hi @Audi86

    Alternatively, you can add a SharePoint script editor web part and then add your JavaScript.

    https://www.spguides.com/script-editor-web-part-sharepoint-2016/

    --------------------------------------------------------------------------------------

    Please vote up and Accept Answer if my reply is helpful.

    1 person found this answer helpful.
    0 comments No comments