How to Use toastr.success in JavaScript?

Estimated read time 1 min read

toastr is a popular JavaScript library for displaying toast notifications on a web page. To display a success notification using toastr, you first need to include the toastr library in your HTML file, then you can use the success method to display the notification. Here’s an example

// Include the toastr library in your HTML file
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>

// In your JavaScript file
toastr.success('Your operation was successful.');

In this example, the toastr.success method is used to display a success notification with the message 'Your operation was successful.'. The toastr library will automatically handle displaying the notification on the screen, and it can be customized using various options, such as the duration, position, and styling. You can find more information on how to use toastr in the library’s documentation.

You May Also Like

More From Author

+ There are no comments

Add yours

Leave a Reply