I want to use toastr to notify the user. I have followed this guide to set it up. But I get the error message: Uncaught TypeError: toastr is not a function
. I have looked at the network tab and the files are loading properly. Tried with a cdn to be sure. But no luck. This is how I tried to use it:
toastr('Are you the 6 fingered man?');
As in the demo. Any suggestions about what I am doing wrong?
According to the documentation you linked, it should be used like this:
toastr.info('Are you the 6 fingered man?')
You forgot to call the function info().
You need to use toastr functions as per below.
See documentation
// Display a warning toast, with no title
toastr.warning('My name is Inigo Montoya. You killed my father, prepare to die!')
// Display a success toast, with a title
toastr.success('Have fun storming the castle!', 'Miracle Max Says')
// Display an error toast, with a title
toastr.error('I do not think that word means what you think it means.', 'Inconceivable!')
// Immediately remove current toasts without using animation
toastr.remove()
// Remove current toasts using animation
toastr.clear()
// Override global options
toastr.success('We do have the Kapua suite available.', 'Turtle Bay Resort', {timeOut: 5000})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With