polyglot/app/javascript/components/modal.js

16 lines
350 B
JavaScript
Raw 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 }