How to add new list item in sharepoint using Javascript button

Gulnar 146 Reputation points
2020-09-09T10:52:04.197+00:00

I have a list it's name Test that has 2 fields(Title and Name).
And I have aspx page that contains html code with Javascript and In this page I have a button that the Employee should click on it to move to another page, And after clicking on this button, a new Item should be added in Test list that should contains(Done in the Title field, name of the employee in the name field).
I tried many codes to add the item, but no one added a new Item in my list. I need your assistance and help.

Microsoft 365 and Office SharePoint For business Windows
0 comments No comments
{count} votes

Accepted answer
  1. ZhengyuGuo 10,586 Reputation points Moderator
    2020-09-10T02:20:20.76+00:00

    Hi @Gulnar ,

    Please refer the Jsom code in attachment to create new item and redirect to another page by a button click:

    23595-createitem.txt

    25073-snipaste-2020-09-16-09-41-32.png

    ![23674-snipaste-2020-09-10-10-14-40.png][3]

    Reference:

    Create List Item in SharePoint using JSOM


    If an Answer is helpful, please click "Accept Answer" and upvote it.

    1: /api/attachments/23595-createitem.txt?platform=QnA [3]: /api/attachments/23674-snipaste-2020-09-10-10-14-40.png?platform=QnA


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.