Showing posts with label Hide Form Toolbar in SPD. Show all posts
Showing posts with label Hide Form Toolbar in SPD. Show all posts

Tuesday, February 16, 2010

Hide Delete Item Option in Form Toolbar of Custom List Form using SPD

To Hide the Delete Item option from the Form Toolbar using Javascript in SPD, use the following javascript function

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

This can also be achieved using jQuery.

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

The advantage of using this jQuery is that it also hides the separator whereas the other normal function doesn't help to achieve this.