I'm having trouble passing a function with an arugment to an eventListener. Here's what I'm doing:
document.getElementById('Sec1_BTN1').addEventListener('click', copyS1(1));
this is the function it's referring to:
function copyS1(elemIDNum) {
var letter_to_copy = document.getElementById('textarea-S1-' + elemIDNum);
letter_to_copy.select();
navigator.clipboard.writeText(letter_to_copy.value);
};
It runs the function upon load, but does not run when I click on the button that the eventListener is attached to. Any ideas of what I can do to fix it? I did some searching, but could've figure it out.