Search code examples
javascriptnotificationstoastr

Adding Id to the toastr notification


Is it possible to Add Id to Toastr Notification? I need to identify one of several notifications when i close it. I use this plugin. https://github.com/CodeSeven/toastr


Solution

  • That's an interesting question. It doesn't look like you can set an ID on the toastr itself. However, you can modify the button used to close the toastr:

    toastr.options.closeHtml = '<button id="toastr1closebtn"><i class="icon-off"></i></button>';
    

    That might be just as good for what you're trying to do.

    I found the option to adjust the close button here.