Getting error "toastr is not a function error" when trying to use toastr

AllramEst picture AllramEst · Dec 19, 2017 · Viewed 11k times · Source

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?

Answer

tobiso picture tobiso · Dec 19, 2017

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().