Typescript with Modals #39538
-
I'm trying to create a Varying modal content using typescript. But the following code keeps failing with the error
// javascript
const exampleModal = document.getElementById('exampleModal')
if (exampleModal) {
exampleModal.addEventListener('show.bs.modal', event => {
// Button that triggered the modal
const button = event.relatedTarget
// Extract info from data-bs-* attributes
const recipient = button.getAttribute('data-bs-whatever')
// If necessary, you could initiate an Ajax request here
// and then do the updating in a callback.
// Update the modal's content.
const modalTitle = exampleModal.querySelector('.modal-title')
const modalBodyInput = exampleModal.querySelector('.modal-body input')
modalTitle.textContent = `New message to ${recipient}`
modalBodyInput.value = recipient
})
} I've been looking for a fix to this for quite sometime now... Cheers, |
Beta Was this translation helpful? Give feedback.
Answered by
julien-deramond
Dec 29, 2023
Replies: 1 comment 3 replies
-
Hey @3baaady07, could you please create a reproducible test case using StackBlitz or any other relevant tools? Ensuring we're on the same page with the configuration and tools will greatly assist in finding a solution together. |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
3baaady07
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @3baaady07, could you please create a reproducible test case using StackBlitz or any other relevant tools? Ensuring we're on the same page with the configuration and tools will greatly assist in finding a solution together.