Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught ReferenceError: Modal is not defined #2347

Open
tangyi90 opened this issue Aug 24, 2024 · 1 comment
Open

Uncaught ReferenceError: Modal is not defined #2347

tangyi90 opened this issue Aug 24, 2024 · 1 comment

Comments

@tangyi90
Copy link

"tw-elements": "^2.0.0",

import { Input, Tab, Carousel, Offcanvas, Collapse, Dropdown, Tooltip, Modal, Ripple, initTWE } from 'tw-elements';
initTWE({ Input, Tab, Carousel, Offcanvas, Collapse, Dropdown, Tooltip, Modal, Ripple });

<script> const myModalEl = document.getElementById("exampleModalCenter"); const modal = new Modal(myModalEl); function login() { modal.show(); } </script>
Uncaught ReferenceError: Modal is not defined
What's going on?
@juujisai
Copy link
Contributor

Hi! I think we are going to need more info here.

Are you using different script tags to import components and different to initialize the Modal? If this is the case then the second script doesn't know about the imported modal from other scripts. You have to import it in the second one aswell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants