diff --git a/app/javascript/components/modal.js b/app/javascript/components/modal.js index a35d32a..f4cdcf0 100644 --- a/app/javascript/components/modal.js +++ b/app/javascript/components/modal.js @@ -1,12 +1,15 @@ const triggerModalEvent = () => { - const btn = document.getElementById("modalTrigger"); - const modal = document.getElementById("myModal"); - if (btn) { - btn.addEventListener('click', function(event) { - $('#myModal').modal('show'); - }); - } + 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 } diff --git a/app/views/pages/_contact.html.erb b/app/views/pages/_contact.html.erb index 7b06c6c..92f1689 100644 --- a/app/views/pages/_contact.html.erb +++ b/app/views/pages/_contact.html.erb @@ -16,19 +16,19 @@