Problem Statement
Add new SharePoint list item as Pop up instead of opening in new page.
Create a SharePoint list with column Title, Name, City, Address.
Click on New Item – Copy the url of new item upto http://Site Name /Teams/Lists/Listname/NewForm.aspx?
Make sure URL should be copied up to http://……..NewForm.aspx?
- Edit the Sharepoint list by using Gear icon on Top Right side
- Click on Insert button on Top Left side then select Media and Content, then click on Script Editor and click Add button on right
- Click on edit snippet
- Paste below javascript code and click insert and the stop editing the page,
- <a href='javascript:displayLayover("http://SitenameTeams/Lists/List/NewForm.aspx?'>New Item</a>
- <script type="text/javascript">
- function displayLayover(url) {
- var options = SP.UI.$create_DialogOptions();
- options.url = url;
- options.dialogReturnValueCallback = Function.createDelegate(null, null);
- SP.UI.ModalDialog.showModalDialog(options);
- }
- </script>
Happy Coading.....:)