如何使用 jQuery 在单击锚点时关闭所有 toastr 消息?

How to close all toastr messages on click an anchor using jQuery?

我使用 toastr 在我的页面中发布通知。如果单击 link,如何关闭所有打开的消息。

检查您是否定义了 toastr 全局对象。

console.log(!!window.toastr);

如果你有,你可以使用 toastr.clear();

$('a.myLinkClass').click(function() {
   window.toastr.clear();
});