Topic: Opening modal in HTML

davi priority asked 2 years ago

Hi. Which instructions inside the <div> tags should I use in order to have the modal opened without the need of a button? I'd prefer to do that with no JS, is it possible? Thanks.

Michał Duszak staff answered 2 years ago

Hi, it's not possible to open a modal without JS or a button.

With JS use show() method:

const modal = document.querySelector('.modal')
const modalInstance = new mdb.Modal(modal);

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: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 3.9.0
  • Device: Desktop
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: No