1

When I want to add a simple SharePoint notification to my page, I can do the following:

 SP.UI.Notify.addNotification("Some process is running...", true);

But when I click on this notification it just closes, even if the process is not finished. Is there any way to forbid its closing on click?

Thanks!

1 Answer 1

1

SP.UI.Notify.addNotification return id of the newly created notification (DOM element). It also attaches click handler on child div element, what you can do is unbind click event by replacing child div with copy:

pure js:

var notifId = SP.UI.Notify.addNotification("Some process is running...", true);
var old_element = document.querySelector("#" + notifId + " > div");
var new_element = old_element.cloneNode(true);
old_element.parentNode.replaceChild(new_element, old_element);  

or with jquery:

var notifId = SP.UI.Notify.addNotification("Some process is running...", true);
jQuery("#" + notifId + " > div").replaceWith(jQuery("#" + notifId + " > div").clone());

Your Answer

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

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