Saturday 24 September 2011

Hide web part title row in Sharepoint


Here is a little Javascript trick to hide webpart Title row. In this example a "Shared Documents" webpart was added to a page and the javascript in a content editor will hide the "Shared Documents" title row.

Here is what goes in the content editor

<script type="text/ecmascript">

ExecuteOrDelayUntilScriptLoaded(HideWebPartTitle, "sp.js");

function HideWebPartTitle()
{

var x=document.getElementsByTagName("h3");

for(var i=0; i<x.length; i++)
{

alert(x[i].innerText);

if(x[i].innerText == 'Shared Documents')
{

var oTable = x[i].parentElement.parentElement.parentElement;
oTable.style.display = 'none';

}
}
}
</script>

Ads by Google

No comments:

Post a Comment