polyglot/app/javascript/components/modal.js

16 lines
350 B
JavaScript
Raw Permalink Normal View History

const triggerModalEvent = () => {
const buttons = document.querySelectorAll(".modalTrigger");
buttons.forEach(btn => {
if (btn) {
btn.addEventListener('click', function(event) {
const btnId = btn.getAttribute('data-user-id')
$("#myModal"+`${btnId}`).modal('show');
});
}
})
}
export { triggerModalEvent }