Uncaught ReferenceError: toastr is not defined


Topic: Uncaught ReferenceError: toastr is not defined

GuYang Li asked 8 years ago

When I use the alert component, it does not work Chrome console prompts me: sign_new.php:126 Uncaught ReferenceError: toastr is not defined at HTMLAnchorElement.<anonymous> (sign_new.php:126) at HTMLAnchorElement.dispatch (jquery-3.1.1.min.js:3) at HTMLAnchorElement.q.handle (jquery-3.1.1.min.js:3) At new.php:126 is : Click me! <script type="text/javascript"> $("#alert-target").click(function () { toastr["info"]("I was launched via jQuery!") }); </script>
Great that you found an answer bro. I will still look into this matter because it should be working from id.
Hello GuYangLi, Did you add id="alert-target to the item that should trigger toastr? example: <button id="alert-target" class="btn btn-primary"> Click me! </button> Regards, Adrian

GuYang Li answered 8 years ago

Thanks bro,Thank you for your reply, I added this id, but it did not work, The browser does not prompt the error, using the jQuery method can not work, But I use this statement: <a class="btn btn-info" onclick="toastr.info('Hi! I am info message.');"> Info message , it works fine
Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: Yes