CodeSeven / toastr

Simple javascript toast notifications

Home Page:http://www.toastrjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: Cannot read properties of undefined (reading 'extend')

voaneves opened this issue · comments

Hey there.

I'm using the CDN version of the JS and CSS and tried to have a button like this:

          <button
            onclick="toastr['success']('Are you the six fingered man?')"
          >
          </button>

And I got this:

toastr.min.js:1 Uncaught TypeError: Cannot read properties of undefined (reading 'extend')
at m (toastr.min.js:1:4693)
at Object.i [as success] (toastr.min.js:1:432)
at HTMLButtonElement.onclick (index.unformatted.html:532:33)

Am I doing anything wrong? I tried to import JQuery too, to no avail.

Thanks!

I've got this too, using the CDN link in an ASP.NET Core application.

@if (TempData["error"] != null)
{
    <script src="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
    <script type="text/javascript">
        toastr.error('@TempData["error"]');
    </script>
}

Error in console:

toastr.js:474 Uncaught TypeError: Cannot read properties of undefined (reading 'extend')
at m (toastr.js:474:40)
at Object.i [as success] (toastr.js:474:40)
at Category:54:16