TW-Elements
TW-Elements copied to clipboard
Trigger Modal using JS
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?
Maybe make a hidden button and trigger a click event on the button?
+1
Connected with the global library name issue: https://github.com/mdbootstrap/Tailwind-Elements/issues/1125 Will be available soon.
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.