Topic: Error Importing modal js

Alexandroni free asked 2 years ago


Expected behavior I'm trying to use the modal of mdb5 but I can import the module. It appears the error: Uncaught SyntaxError: import declarations may only appear at top level of a module

Actual behavior

Resources (screenshots, code snippets etc.) https://mdbootstrap.com/snippets/standard/alexandroni/3072874


Alexandroni free answered 2 years ago


You must use de mdb object instead of bootstrap object


Dawid Wajszczuk staff answered 2 years ago


Hi,

Try replacing <script type="text/javascript"> with <script type="module">. Also change src="js/mdb.min.js to something like src="./js/mdb.min.js or whatever is an appropriate path to this file.

Keep coding,
Dawid


FREE CONSULTATION

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

Status

Closed

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 3.5.1
  • Device: pc
  • Browser: firefox
  • OS: windows
  • Provided sample code: No
  • Provided link: Yes