get List/Library item id using QueryString
Here is the code snippet to get the SharePoint list or library item id using the Query String
<script language="javascript" type="text/javascript">
$(document).ready(function(){
//alert('onLoad');
var itemID= getItemId()
//alert(itemID);
});
function getItemId()
{
regex = new RegExp("[\\?&]"+"ID"+"=([^&#]*)");
qs = regex.exec(window.location.href);
//alert(qs[1]);
var recordId=qs[1]
return recordId;
}
<script language="javascript" type="text/javascript">
$(document).ready(function(){
//alert('onLoad');
var itemID= getItemId()
//alert(itemID);
});
function getItemId()
{
regex = new RegExp("[\\?&]"+"ID"+"=([^&#]*)");
qs = regex.exec(window.location.href);
//alert(qs[1]);
var recordId=qs[1]
return recordId;
}
Comments
Post a Comment