TW-Elements icon indicating copy to clipboard operation
TW-Elements copied to clipboard

Trigger Modal using JS

Open Aniruddh-J opened this issue 2 years ago • 2 comments

Hello,

Thanks for the wonderful library. I was going through the documentation but I couldn't find any way to trigger the modal with JS.

I have a project coming in where the front-end will be in Vue3. Is there any way I can achieve it?

Aniruddh-J avatar Jun 15 '22 17:06 Aniruddh-J

Maybe make a hidden button and trigger a click event on the button?

Aniruddh-J avatar Jun 15 '22 17:06 Aniruddh-J

+1

ArthurGorbenko avatar Aug 09 '22 22:08 ArthurGorbenko

Connected with the global library name issue: https://github.com/mdbootstrap/Tailwind-Elements/issues/1125 Will be available soon.

smolenski-mikolaj avatar Nov 29 '22 11:11 smolenski-mikolaj

You can actually do some javascript trikery with this.

const backdrop = document.getElementsByClassName("modal-backdrop")[0];
backdrop.classList.add("show");

const modal = document.getElementById("myModal");
modal.classList.add("show");

worked for me. hope it does for you too.

kespaldon avatar Dec 08 '22 13:12 kespaldon