Topic: MDB5 Alert throws error if called by JS

jczeledonp free asked 3 years ago

Expected behavior


Actual behavior

Firefox: Uncaught TypeError: can't access property "show", mdb.Alert.getInstance(...) is undefined

Chrome: Uncaught TypeError: Cannot read property 'show' of null

Resources (screenshots, code snippets etc.) I'm using MDB5 PRO 3.3 version. Also tried with new MDB5 3.4 version but it comes with mdb.min.js 3.3.0 , NOT 3.4.0.

In your website works with 3.4, not with older versions. But I can't get the mdb.min.js 3.4.0 version

Grzegorz Bujański staff commented 3 years ago

Check out my example:

It works fine. Can you send your example which causes this error?

cfuller free answered 3 years ago

I am having the same issue on my site, were you ever able to find a resolution. When I use the exact code that is recommended on the mdb builder site, I still get the error, when I do the mdb.Alert.getInstance(document.getElementById("alertExample")) JS command, it is returning as null. Thanks!

Dawid Wajszczuk staff commented 3 years ago

Hi. Can you provide more information about you issue (maybe links or a snippet with code that causes problems)? Also which version of MDB are you using? Here is the snippet with MDB 3.7.1 and I don't see such errors

Michał Duszak staff commented 3 years ago

This issue has continuation in the new topic:

Please insert min. 20 characters.


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



Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: 3.2.0
  • Device: Laptop
  • Browser: Chrome, Firefox
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No