1

On the Home page, to the top right corner there is a button link "Summer 13 Developers" found. One of my client's requirement is to remove that button on the home page. Im using this code to hide the button but custom component would appear in the home page layout in left side. how can hide this name(custom component) from the home page layout. Im using PE Code:

<script>
function hideBtns()
{
if(document.getElementsByName('whats_new')[0]!=null) document.getElementsByName('whats_new')[0].style.display = 'none';
if(document.getElementsByName('whats_new')[1]!=null) document.getElementsByName('whats_new')[1].style.display = 'none';
}
if (window.addEventListener)
{
window.addEventListener('load', hideBtns, false);
}
else if (window.attachEvent)
{
window.attachEvent('onload', hideBtns);
}
</script>
0

You could also use the below reusable to hide the components that you do not want to show. All you have to do is add the names of the sidebar component name to the array.

<script type="text/javascript" src="load you jQuery library from static resource"></script>
<script type="text/javascript">
//add all the names of your custom side bar component in the below array which you want to hide.
var sideBarToHide = ["js Hide button", "custom side bar component", "Hide all components"];
var j$ = jQuery.noConflict();
j$(function(){ 
    j$("h2.brandPrimaryFgr").each(function(){
        if(j$.inArray(j$(this).text(), sideBarToHide) > -1){
            j$(this).parent("div").parent("div").hide();     
        }
    }); 
});
</script>
1

If you're already using a sidebar/homepage component to remove or hide html from the page using Javascript you can also do the same and hide the very component you're doing this from.

<div id="jsCode">
    <script src="jquery somewhere" />
    <script>
                /*Hide this component from the sidebar*/
                $('#jsCode').parents('.sidebarModule').hide();
   </script>
</div

This example uses jQuery but you can do the same in plain JavaScript.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.