function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sreenivasAppssreenivasApps 

hide edit and delete links of a relatedList using vf area componen

i want to hide or desable edit and delete links from a related list but i don't want to remove their permissions.

when i used the below code, its showing objectHtml collection and length is 0 so its not entering in to the loop. 

<apex:page >
<script> 
window.onload = function(){
 var userProfile = 'System Administrator'; 
  if(userProfile = 'System Administrator')      
  {
  var divObj = document.getElementsByClassName('bRelatedList');
  alert(divObj);
  if(divObj != null && divObj.length)
  {         
  for(var i=0;i<divObj.length;i++)
  {
  var items = divObj[i].getElementsByTagName("a");
  if(items != null )
  {
  for(var j=0;j<items.length;j++)
  {    
  if(items[j].innerHTML=='Del')
  {    
  items[j].style.display = "none";
  }    
  }         
  }         
  }
  }    
  var btns = document.getElementsByClassName("btn");
  if(btns != null )    
  {    
  for( var i=0;i<btns.length;i++)
  { if(btns[i].name == 'delete' || btns[i].name == 'del')    
  {    btns[i].style.display = "none";    }    
  }
  }  
    }};
</script>
</apex:page>
KaranrajKaranraj
Using jquery you can hide the link in the visualforce page, try the below code
 
<apex:page tabStyle="Account" standardController="Account">
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"/>
 <apex:relatedList list="contacts"/>
<script>
    // Using jQuery, hide all of the actionLinks
    $(".actionLink").css("display","none");
</script>
</apex:page>

Thanks,
http://karanrajs.com

 
sreenivasAppssreenivasApps
Hi Karanraj,

Thanks for reply, i used the above code but unfortunately its not working. Don't know am i missing something.
Actually its a visualforce Area component. Related list links should be hidden, when the page is loaded.