I am new to Sharepoint Online and was trying to insert data to sharepoint list from sharepoint page containing cotent editor web part but I guess there is some problemwith my code or something which is making web part uneditable after that.
Below is my code:
HTML:
<html>
<head>
<script type="text/javascript" src="login_javascript.js"></script>
</head>
<body>
<clocform>
Name:<input type="text" name="name" id="name"><br>
Email:<input type="email" name="email" id="email"><br>
Password:<input type="password" name="password" id="password"><br>
<input type="button" name="submit" value="Submit" onclick="loginSubmit()">
</clocform>
</body>
Javascript:
function loginSubmit(){
alert("Form submitted");
var context=SP.ClientContext.get_current();
var listTitle="LoginForm1";
var login_form_list=context.get_web().get_lists().getByTitle(listTitle);
var ListItemCreationInformation=new SP.ListItemCreationInformation();
var listItem=login_form_list.addItem(ListItemCreationInformation);
var name=document.getElementById("name").value;
var email=document.getElementById("email").value;
var password=document.getElementById("password").value;
listItem.set_item('Person',name);
listItem.set_item('Email',email);
listItem.set_item('Password',password);
listItem.update();
context.load(listItem);
context.executeQueryAsync(AddListItemSucceeded, AddListItemFailed);
}
function AddListItemSucceeded()
{
alert("added");
//retriveListItem();
}
function AddListItemFailed(sender, args)
{
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}