Monday, February 15, 2010

Hide Delete Item from Form Tool Bar of Custom List Form using SPD 2007

To hide the Delete Item option from the Form toolbar of a Custom List Form using SharePoint Designer 2007, use the following Javascript in the <Body> tag's OnLoad event.

function HideDeleteItem()
{
var aList=document.getElementsByTagName("a");
for(i=0;i {
if(aList[i].innerHTML=="Delete Item")
{
aList[i].parentElement.parentElement.style.display="none";
}
}
}

OR

use the following lines of jQuery in a javascript function.

$(document).ready(function() {
$("td.ms-titlearea").hide();
$("a[title='Delete Item']").parent().parent().parent().hide();
$("td.ms-separator:nth-child(4)").hide();
});

Note: Download and refer a copy of the latest jQuery script file for this to work.

No comments:

Post a Comment