Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
addNotification(strHtml, bSticky) Method
Collapse the table of content
Expand the table of content

SP.UI.Notify.addNotification(strHtml, bSticky) Method

SharePoint 2010

Last modified: January 12, 2011

Applies to: SharePoint Foundation 2010

Adds a notification to the page. By default, notifications appear for five seconds.

var value = SP.UI.Notify.addNotification(strHtml, bSticky);


The message inside the notification.


Specifies whether the notification stays on the page until removed.

Type: String – The ID of the notification that was added to the page.

The following example creates input buttons on an application page that display and remove alert notifications and status messages.

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<script type="text/ecmascript" language="ecmascript">

var statusId = '';
var notifyId = '';

function AddNotification() {
    notifyId = SP.UI.Notify.addNotification("Hello World!", true);

function RemoveNotification() {
    notifyId  = '';

function AddStatus() {
    statusId = SP.UI.Status.addStatus("Status good!");
    SP.UI.Status.setStatusPriColor(statusId, 'red');

function RemoveLastStatus() {
    statusId = '';

function RemoveAllStatus() {


    <input id="Button1" type="button" value="Add Notification" onclick="AddNotification()" />
    <input id="Button2" type="button" value="Remove Notification" onclick="RemoveNotification()" />
    <input id="Button3" type="button" value="Add Status" onclick="AddStatus()" />
    <input id="Button4" type="button" value="Remove Last Status" onclick="RemoveLastStatus()" />
    <input id="Button5" type="button" value="Remove All Status" onclick="RemoveAllStatus()" />

© 2015 Microsoft