3

I'm wondering if it is possible to remove the "Delete" hypertext on the Edit Form whenever attachments are added. I've tried to use the JavaScript String replace() method to no luck, I've attached the code to.

How could I remove the 'Delete'?

<script src="https://code.jquery.com/jquery-1.7.2.min.js" type="text/javascript"></script>
<script>
$(document).ready(function() {
    var str = document.getElementById("idAttachmentsTable").innerHTML; 
    var res = str.replace("Delete", "");
    document.getElementById("idAttachmentsTable").innerHTML = res;
});
</script>
4

You can do it with this piece of css:

.ms-delAttachments
{
 display: none;
}

You can open the edit form in the Advanced mode in SharePoint designer, find the <SharePoint:StyleBlock runat="server"> tag and include this css there. This is how it should look like after your change (tested on new form on custom list):

<SharePoint:StyleBlock runat="server">
/* This line is added automatically so just leave it there */
.ms-bodyareaframe {
    padding: 8px;
    border: none;
}

.ms-delAttachments
{
 display: none;
}
</SharePoint:StyleBlock>
  • Thanks dude - I've never edited CSS on SharePoint before how do I input this code? I'm a big newbie when it comes to SharePoint. – Gareth James Dec 14 '17 at 11:13
  • I've edited my answer with the additional explanation. – Damjan Tomic Dec 14 '17 at 11:23
0

you can do it by more simple way, just edit your form using browser put one content editor write this code in style tag .ms-delAttachments { display: none; } save the page.

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.