I would like to open a modal that shows a pdf according to the selected text, but only the first one in the list is shown. What should I do?
index.html
<p><a id="other-activies-link">Semana Omnistack 11</a></p>
<p><a id="other-activies-link">28ª Semana do IME</a></p>
<div id="myModal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<iframe id="myFrame" frameborder="0" allowfullscreen></iframe>
</div>
</div>
scripts.js
const selectedActivity = document.querySelectorAll("#other-activies-link");
selectedActivity.forEach((link) => {
link.addEventListener("click", () => {
document.getElementById(
"myFrame"
).src = `/files/${event.target.textContent}.pdf`;
});
});