I've figured out how to disable drag and drop functionality on my document list. The problem is, it still says "or drag files here" text beside the +new document link. I want to keep the +new document, just get rid of the rest.
4 Answers
This is a real ugly solution as the text could still be visible if you use markup.
Add a script editor to the same page as the document library and add this.
<style type="text/css">
.ms-soften, .ms-soften:link, a.ms-soften:visited, .ms-soften:hover, .ms-soften:active
{
color: #fff;
cursor: default;
}
</style>
-
In addition your can add properties like display: none or visibility: hidden– AveenavApr 1, 2016 at 18:31
-
@Aveenav Not for this one, as it would hide the button "+ New Document" to. :) Apr 4, 2016 at 7:40
Try this with jQuery. I haven't tested this myself so you may need to tweak it.
var a = $("a[id^='idHomePageNewDocument']");
var aParent = a.parent();
a.remove();
aParent.html("");
aParent.append(a);
You'll need to add a reference to the jQuery library on your document library's view page (every view page of the document library, in fact). And you'll need to add a reference to a second JavaScript file that contains the above code or add the code directly using a Content Editor or Script Editor web part.
I had this same issue. I was able to remove the text using this script. It removes the text from the td element, but leaves the child elements alone.
$("td.ms-list-addnew").contents().filter(function(){
return (this.nodeType == 3);
}).remove();
The easiest way I have found to achieve this is to add some CSS as follows:
.ms-dragDropAttract { display: none !important; }