I am using pnotify plugin. My code is as follows:
$('.input_elements').on('change', function() {
if ($(this).val() > 2) {
$.pnotify({
text: 'Quantity exceeds the number of available items.',
type: 'error',
delay: 2500,
history: false,
sticker: true
});
} else {
$.pnotify({
text: 'Saved.',
type: 'success',
delay: 2500,
history: false,
sticker: true
});
}
});
My question is, how can I make all other visible notifications on page go away when this notification shows up on .input_elements
change event. Is there an option on pnotify that makes it go away if another is opened?
You can use PNotify.removeAll() to remove all the notifications.