SharePoint: Change the “Add New” message for a web part


A version of this article for SharePoint 2010 is here:



How to change from “Add new announcement”:


to “Click here to add team news”:



ID’s used by web parts

Each web part has a different ID. You will need to modify the following code with the needed ID. Note that some lists use the same ID, like Documents and Wikis.


Web Part Default message ID for “document.all” in the code below
Announcements Add new announcement "Add new announcement"
Links Add new link "idHomePageNewLink" 
Calendar Add new event "idHomePageNewEvent"
Picture Library Add new picture "idAddPicture"
KPI List Add new item "idAddNewItem"
Tasks Add new item "idAddNewTask"  *
Project Tasks Add new item "idAddNewTask"  *
Document Library Add new document "idAddNewDoc"   *
Wiki Add new Wiki page "idAddNewDoc"   *
Survey Respond to this survey "idNewSurveyResponse"
Discussion Add new discussion "idAddNewDiscuss"

* = Shared with another list


  • Add an Content Editor Web Part (CEWP) below the Announcements web part.
  • From the CEWP click Edit and Modify Shared Web Part
  • Click the Source Editor button
  • Paste the following:
  document.all("Add new announcement").innerHTML="your new text goes here"
  • Click OK, then OK, then Exit Edit Mode

If you have more than one web part on the page with the same ID then you need to change the [0] to the number for the web part. 0=first web part, 1=second web part, etc.

document.all("Add new announcement")[0].innerHTML="your new text" 


If you want to get rid of the little icon just before text try this:

  var ttn_x;
  ttn_x=document.all("Add new announcement")
  // replace the text
  ttn_x.innerHTML="Click here to add team news"
  // delete or replace the image
  ttn_x.parentNode.innerHTML = ttn_x.parentNode.innerHTML.replace(/<IMG alt="" src="\/_layouts\/images\/rect\.gif">&nbsp;/,"")

If you have more than one web part on the page with the same ID then you need to change the [0] to the number for the web part. 0=first web part, 1=second web part, etc.

The image is a fragment of HTML that looks like this:

<IMG alt="" src="\/_layouts\/images\/rect\.gif">&nbsp;

The code above replaces this. JavaScript’s replace command uses regular expressions so you need to escape the “/” and “.” characters.




Prakash JJ said...

Yes, But if you remove (close) the content Editor Web Part the changes are lost. How to remove the Content Editor WP and still retain the settings made.

Any ideas?

Looking forward to your reply.


Mike Smith said...

Prakash JJ,

Don't remove it. It contains the JavaScript. Just edit its properties (Edit, Modify Shared Web Part) and in the Appearance section change the Chrome to "None".

You could also edit the page in SharePoint Designer and add the JavaScript at the bottom of the page (just before /BODY) or you could add this to the master page and it will then impact all web parts in all pages that use the master page.


Matt@HopZine said...

Hi Mike,
Thanks for the script to do this.
I got it working but now I'm losing my hair trying to change the default "There are no active announcements. To add a new announcement, click "Add new announcement" below."

This is a bit of a sticking point if I change the "Add new announcement" text!


Note to spammers!

Spammers, don't waste your time... all posts are moderated. If your comment includes unrelated links, is advertising, or just pure spam, it will never be seen.