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>

3 Answers 3

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>
2
  • 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. Dec 14, 2017 at 11:13
  • I've edited my answer with the additional explanation. Dec 14, 2017 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.

0

Below is tested and it works:

<script type="text/javascript" src="/Pages/jquery-1.9.0.js" ></script>
<script>
$(document).ready(function() {  
    $("td.ms-propertysheet:contains('Delete')").hide(); 
});
</script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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