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

const myModal = document.getElementById('myModal') doesn't work #40613

Closed
3 tasks done
wei886-tw opened this issue Jul 9, 2024 · 3 comments
Closed
3 tasks done

const myModal = document.getElementById('myModal') doesn't work #40613

wei886-tw opened this issue Jul 9, 2024 · 3 comments

Comments

@wei886-tw
Copy link

wei886-tw commented Jul 9, 2024

Prerequisites

Describe the issue

I'm using Vue3 "^3.4.21" and "bootstrap": "^5.3.3", and I'm using const myModal = document.getElementById('myModal') on mounted, but chrome devtool shows [Vue warn]: Unhandled error during execution of native event handler
image

Reduced test cases

I used

const myModal = document.getElementById('myModal')
const myInput = document.getElementById('myInput')

myModal.addEventListener('shown.bs.modal', () => {
  myInput.focus()
})

but doesn't work

What operating system(s) are you seeing the problem on?

macOS

What browser(s) are you seeing the problem on?

Chrome

What version of Bootstrap are you using?

v5.3.3


Note: edited by maintainer for correct Markdown syntax

Copy link
Contributor

github-actions bot commented Jul 9, 2024

Hello @wei886-tw. Bug reports must include a live demo of the issue. Per our contributing guidelines, please create a reduced test case on CodePen or StackBlitz and report back with your link, Bootstrap version, and specific browser and Operating System details.

@Hichem-elAbassi
Copy link

Can you try catch it just to see ?

@wei886-tw
Copy link
Author

I useimport Modal from 'bootstrap/js/dist/modal'; solve the bug

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

No branches or pull requests

3 participants