question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

toastr[type] is not a function

See original GitHub issue

Hi, I’m trying to call toastr like this:

var showToastr = function (msg, type) { return toastr[type](msg); };

var type = 'info'; var message = 'Test';

showToastr(message, type);

and it works but console prints error: Uncaught TypeError: toastr[type] is not a function

Can you give me an advice how to deal with that? I’d like to avoid any errors in console.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:2
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
rodrigogscommented, Oct 4, 2017

In my case it happened due to jQuery slim.

1reaction
liujundezhanghaocommented, Dec 18, 2018

@rodrigogs Thank you,you the best

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting error "toastr is not a function error" when trying to use ...
But I get the error message: Uncaught TypeError: toastr is not a function . I have looked at the network tab and the...
Read more >
How to resolve the error 'TypeError: $.toast is not a function' in ...
Basically, this error tells you that the element you were trying to select was not found (hence, it cannot find the “style” property...
Read more >
Uncaught TypeError: $(...).toast is not a function
Sometimes we get an error Uncaught TypeError: $(...).toast is not a function in the console using the toast() method in the HTML page....
Read more >
Toaster is throwing an error - Material Design for Bootstrap
I am getting an error i.e., $.toaster is not a function while using toaster I don't know how to fix it so please...
Read more >
toaster clear does not work inside a jQuery function - Edureka
The error - "TypeError: $.toast is not a function" is telling you that the method toast() is not present in your JS file....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found