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?
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?
Share Improve this question edited Dec 19, 2017 at 9:50 klugjo 20.9k10 gold badges64 silver badges81 bronze badges asked Dec 19, 2017 at 9:48 AllramEstAllramEst 1,4494 gold badges28 silver badges55 bronze badges 3 |3 Answers
Reset to default 8According 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})
Please use toastr with info, warning,success,error or option.
toastr.info('Are you the 6 fingered man?');
toastr
like thisCommand: toastr["success"]("test message", "test")
. – AllramEst Commented Dec 19, 2017 at 9:50