Opening modal in HTML


Topic: Opening modal in HTML

davi pro premium priority asked 10 months 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 10 months 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)
modalInstance.show();

https://mdbootstrap.com/snippets/standard/m-duszak/3311866#js-tab-view


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: Pro
  • 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