When a list or library does not have any items in it, a message will display that says something like:
There are no items to show in this view... To add a new item, click "New" or "Upload".
These instructions explain how to modify or remove that message.
Create a Text File
- Begin by creating a new text file. You can do this in any text editing software, such as Notepad.
- In the text file, paste in this text:
var a = document.getElementsByTagName("TD")
for (var i=0;i<a.length;i++)
a[i].innerHTML = "There are no items to display here.";
- Note: The highlighted text above can be modified to be whatever message you want to display. To remove a message, just remove the highlighted text.
- Save the file.
Create a New Library
Next, you will need to create a library within your site to store that text file.
- Navigate to your portal site and create a new Document Library called "Embedded Content". See Creating a List or Library for instructions.
- In this new library, upload the text file you saved in the previous step. (See Populating Documents in a Document Library for instructions.)
- Once the file has been uploaded, copy the URL of the file into your clipboard.
- Do this by right-clicking on the document's Title and selecting Copy shortcut or Copy link address (depending on your browser)
Add a Web Part to Site
Now you need to add a Content Editor web part to the front page of your site that is linked to that text file. When the site loads, the web part will grab the text file and read and run the script.
- Navigate to the front page of your site and add a Content Editor web part. (See Adding a Content Editor Web Part)
- Edit the new web part .
- In the menu that appears on the right, do the following:
- Paste the URL of the text file into the "Content Link" field. This will cause the script in the text file to run when the site loads.
- Under "Layout", check the "Hidden" box. This will hide the web part.
- Update the "Zone Index" to a high number, which will move the web part down to the bottom of the page.
- Click OK.
- Save your changes (be sure to publish if necessary!).
The message should be changed now!
Please note that this script will change the message on EVERY web part on the page that is displaying an empty library or list, so make sure your message is appropriate for any of those web parts.