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

Hide edit and delete button in standard detail page using jquery or Javascript

Hi ,


I am trying to hide standard edit/delete button from standard detail page.


I tried using Javascript and Jquery but none is working.






<script src="" type="text/javascript"></script>
<script type="text/javascript">
$j = jQuery.noConflict();



Please let me know if some thing needs to be changed in the above code, or let me know if any easy solution other than record types.





//Add jQuery from Google's secure servers
<script type="text/javascript" src=""></script>

<script type="text/javascript">

//Prevent conflict between jQuery and salesforce scripts
$j = jQuery.noConflict();
//This function hides the [New] button from the related list in a specific tab
$j(document).ready(function hideButton(){
    //Get the current url
    var url = window.location.href;
    //Change the value of tabUrl with the URL of your tab
    var tabUrl = "";//This is my contacts tab url
    if(url.indexOf(tabUrl) !== -1){





Have you considered creating a security model that denies users the edit and delete permissions?  This will prevent the Edit and Delete buttons from appearring.  It will also prevent Edit and Del action links in list views.  This is probably the easiest way to do this, and it has the advantage of working for all record types of the object.  And you can give controlled access to certain users (and system administrators).


You could also edit the page layout to remove the Edit and Delete buttons.  This will need to be done for every record type of the object and in the future for any new records types.  This also doesn't prevent the Edit and Del action links in list views, so your users will have a way around the page layout.


Using JavaScript/JQuery seems like a difficult way to do this.  What exactly is your use case?  Are you trying to prevent certain users from editing/deleting records?