Hiding the view selection in a SharePoint list

I have to hide the List View selection box on the top right hand corner in one of the SharePoint lists that I created. It is to avoid users changing any pre-defined settings and seeing other people’s views.

For example, in a leave form list, you should only see your own leaves but not your managers view which contains other people’s leaves.

To do that, apply the following Javascript onto your list view:

function hideViewMenu() {
var TDs = document.getElementsByTagName("TD");
for (var i=0; i
if (TDs[i].className == "ms-listheaderlabel") {
var tableNode = TDs[i].parentNode;
tableNode.style.display = 'none';
break;
}
}
}

Using jQuery

$(function() {
$("td[class='ms-listheaderlabel']").parent().hide();
});

Spread the word. Share this post!

Leave A Reply

Your email address will not be published. Required fields are marked *