Steps
- Open your SharePoint site.
- Edit SharePoint page and add a Content Editor WebPart.
- Add JavaScript code given below into CEWP.
- Save the page and hit F5.
Code snippet
- $(document).ready(function
- {
- deletelistitem();
- });
- function deletelistitem() {
- var clientContext = new SP.ClientContext(https://gowtham.sharepoint.com/tutorials");
- var oList = clientContext.get_web().get_lists().getByTitle('Announcements');
- var itemCreateInfo = new SP.ListItemCreationInformation();
- this.oListItem = oList.addItem(itemCreateInfo);
- oListItem.set_item('Title', 'Test Item!');
- oListItem.set_item('Body', 'This Item has added Programmatically!');
- oListItem.update();
- clientContext.load(oListItem);
- clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
- }
- function onQuerySucceeded() {
- alert('Item created sucessfully: ' + oListItem.get_id());
- }
- function onQueryFailed(sender, args) {
- alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
- }

Mohamed RestomPosted Jun 14, 2019, 3:41 AM
It should be Add a list item
Manveer SinghPosted Oct 11, 2018, 5:48 AM
You have mentioned title of process for delete, however it's for create.