Wednesday, October 28, 2015

how to get list item id in Edit/Display form SharePoint using Jquery?

Add a script to DispForm.aspx and EditForm.aspx

ID is actually already in the browser window

We are going to add a this script to grab the ID in the page.


<script type="text/javascript">
function GetID()
{
var getid = new RegExp("[\\?&]"+"ID"+"=([^&#]*)");
var value = getid.exec(window.location.href);
alert(getid);alert(value[1]);}

_spBodyOnLoadFunctionNames.push("GetID");
</script>

No comments:

Post a Comment